3. Find the minimum value of the real number $k$ such that for any real numbers $x, y, z$ not all positive, the inequality
$$
\begin{array}{l}
k\left(x^{2}-x+1\right)\left(y^{2}-y+1\right)\left(z^{2}-z+1\right) \\
\geqslant(x y z)^{2}-x y z+1
\end{array}
$$

always holds.
3. First, prove a lemma.

Lemma When $s, t$ are at least one not greater than 0, we have
$$
\frac{4}{3}\left(s^{2}-s+1\right)\left(t^{2}-t+1\right) \geqslant(s t)^{2}-s t+1 .
$$

Proof Equation (1) is equivalent to
$$
\begin{array}{l}
\left(s^{2} t^{2}-4 s^{2} t+4 s^{2}\right)-\left(4 s t^{2}-7 s t+4 s\right)+ \\
\left(4 t^{2}-4 t+1\right) \geqslant 0 .
\end{array}
$$

When $s, t$ have exactly one not greater than 0, assume without loss of generality that $s \leqslant 0, t>0$. Then equation (2) is equivalent to
$$
s^{2}(t-2)^{2}-4 s(t-1)^{2}-s t+(2 t-1)^{2} \geqslant 0,
$$

which is clearly true.
When $s \leqslant 0, t \leqslant 0$, equation (2) is equivalent to
$$
s^{2}(t-2)^{2}-4 s t^{2}+7 s t-4 s+(2 t-1)^{2} \geqslant 0
$$

which is also true.
Back to the original problem.
Now we prove: If $x, y, z$ are not all positive numbers, then
$$
\begin{array}{l}
\frac{16}{9}\left(x^{2}-x+1\right)\left(y^{2}-y+1\right)\left(z^{2}-z+1\right) \\
\geqslant(x y z)^{2}-x y z+1 .
\end{array}
$$

In fact, if $x, y, z$ have positive numbers, assume without loss of generality that $y>0$. Then $x, z$ have at least one non-positive, assume without loss of generality that $z \leqslant 0$. At this time, in the lemma, let
$$
(s, t)=(y, z),(s, t)=(x, y z),
$$

we get equation (3).
If $x, y, z$ are all non-positive, then in the lemma, let
$$
(s, t)=(x, y),(x, t)=(x y, z) \text {, }
$$

we get equation (3).
Therefore, $k \geqslant \frac{16}{9}$.
On the other hand, taking $(x, y, z)=\left(\frac{1}{2}, \frac{1}{2}, 0\right)$, we know that $k$ can achieve the minimum value $\frac{16}{9}$.