3. For sets $A, B$ with union $A \cup B=\left\{a_{1}, a_{2}, a_{3}\right\}$, when $A \neq B$, $(A, B)$ and $(B, A)$ are considered different pairs. The number of such $(A, B)$ pairs is
(A) 8;
(B) 9;
(C) 26;
(D) 27.
3. (D)

Given $A \cup B = \{a_{1}, a_{2}, a_{3}\}$, then the subsets $A, B$ can have at most 3 elements.
(1) If $A = \{a_{1}, a_{2}, a_{3}\}$, then the possible $B$ can be an empty set, a single-element set, a two-element set, or a three-element set. There are $C_{3}^{0} + C_{3}^{1} + C_{3}^{2} + C_{3}^{3} = 2^{3}$ such $B$. At this time, $(A, B)$ has $C_{3}^{3} \cdot 2^{3}$ pairs.
(2) If $A$ is a two-element set, then there are $C_{3}^{2}$ ways, and the corresponding $B$ has $2^{3}$ ways $\left(C_{2}^{0} + C_{2}^{1} + C_{2}^{2} = 2^{2}\right)$. At this time, $(A, B)$ has $C_{3}^{2} \cdot 2^{2}$ pairs.
(3) If $A$ is a single-element set, then there are $C_{3}^{1}$ ways, and the corresponding $B$ has 2 ways. At this time, $(A, B)$ has $C_{3}^{1} \cdot 2$ pairs.
(4) If $A$ is an empty set, then there is $C_{3}^{0}$ way, and the corresponding $B$ has 1 way. At this time, $(A, B)$ has $C_{3}^{0} \cdot 1$ pairs.
$\therefore$ The total number of such $(A, B)$ pairs is
$C_{3}^{3} \cdot 2^{3} + C_{3}^{2} \cdot 2^{2} + C_{3}^{1} \cdot 2 + C_{3}^{0} \cdot 2^{0} = 3^{3} = 27$. Therefore, the answer is (D).