Solve
$x y z+z=z(x y+1)=0 \Rightarrow z=0$ or $x y=-1$.
When $z=0$, $\left\{\begin{array}{l}x+y=0, \\ x y+y=y(x+1)=0\end{array} \Rightarrow\left\{\begin{array}{l}x=0, \\ y=0\end{array}\right.\right.$ or $\left\{\begin{array}{l}x=-1, \\ y=1 .\end{array}\right.$
When $x y=-1$, $\left\{\begin{array}{l}(x+y)^{2}=y-1, \\ x y=-1\end{array} \Rightarrow\left(y-\frac{1}{y}\right)^{2}=y-1 \Rightarrow y^{2}+\frac{1}{y^{2}}=y+1\right.$ $\Rightarrow y^{4}-y^{3}-y^{2}+1=(y-1)\left(y^{3}-y-1\right)=0$. Since $y^{3}-y-1=0$ has no rational roots, then $y=1 \Rightarrow x=-1$. Therefore, the number of real solutions $(x, y, z)$ is 2, so the answer is $B$.
5. The number of rational solutions $(x, y, z)$ for the system of equations $\left\{\begin{array}{l}x+y+z=0, \\ x y z+z=0, \\ x y+y z+x z+y=0\end{array} \quad\right.$ is
A. 1
B. 2
C. 3
D. 4