2. Given that $a$ and $b$ are rational numbers, and among $a+b$, $a-b$, $a b$, and $\frac{a}{b}$, exactly three of these numbers are equal. Then the value of $(2 a)^{\prime \prime}$ should be ( ).
(A) 0
(B) 1
(C) -1
(D) $\pm 1$
2.D.

Since $b \neq 0$, we have $a+b \neq a-b$.
Thus, $ab = \frac{a}{b}$. Solving this, we get $a=0$ or $b= \pm 1$.
If $a=0$, then $b=0$ must hold, which is a contradiction;
If $b=1$, then among $ab$, $\frac{a}{b}$, $a+b$, and $a-b$, it is impossible for three of them to be equal;

When $b=-1$, we have $ab = \frac{a}{b} = a+b$ or $ab = \frac{a}{b} = a-b$, corresponding to $a$ values of $\frac{1}{2}$ or $-\frac{1}{2}$.
Therefore, $(2a)^b = \pm 1$.