The space is generated by the \undergroup size, as you can see by removing the \phantom command:

So you can smash both \undergroup and \overgroup, but with \mathclap to get them centered. Use this small hack to draw them a the good place:
\settowidth{\sometempdim}{123} % get content width
\kern 0.5\sometempdim\relax % move to the middle of the expression
\mathclap{\undergroup{\phantom{123}}} % typeset the \undergroup sign
\kern -0.5\sometempdim\relax % go back
123 % typeset the expression
Define some dedicated commands for that:
\makeatletter
\newcommand*{\phantomundergroup}[1]{%
\settowidth{\@tempdima}{#1}
\kern 0.5\@tempdima\relax
\mathclap{\undergroup{\phantom{#1}}}
\kern -0.5\@tempdima\relax
}
\newcommand*{\phantomovergroup}[1]{%
\settowidth{\@tempdima}{#1}
\kern 0.5\@tempdima\relax
\mathclap{\overgroup{\phantom{#1}}}
\kern -0.5\@tempdima\relax
}
\makeatletter
Here I used \@tempdima, which is already defined by LaTeX (and hopefully not used internally by \mathclap, \overgroup nor \phantom). But you can use any length if you defined it before. The \makeatletter...\makeatother are necessary to handle the @ in \@tempdima name.
Full code:
\documentclass{article}
\usepackage{amsmath,mathtools}
\usepackage{mathabx}
\makeatletter
\newcommand{\phantomundergroup}[1]{%
\settowidth{@tempdima}{#1}
\kern 0.5@tempdima\relax
\mathclap{\undergroup{\phantom{#1}}}
\kern -0.5@tempdima\relax
}
\newcommand{\phantomovergroup}[1]{%
\settowidth{@tempdima}{#1}
\kern 0.5@tempdima\relax
\mathclap{\overgroup{\phantom{#1}}}
\kern -0.5@tempdima\relax
}
\makeatletter
\begin{document}
\begin{align}
12345\
\phantomundergroup{123}12
\phantomovergroup{345}345
\end{align}
\end{document}
