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}\right.$ is ( ).
(A) 1
(B) 2
(C) 3
(D) 4
5.B.

If $z=0$, then $\left\{\begin{array}{l}x+y=0, \\ x y+y=0 .\end{array}\right.$
Solving, we get $(x, y)=(0,0),(-1,1)$.
If $z \neq 0$, from $x y z+z=0$, we get $x y=-1$.
From $x+y+z=0$, we get $z=-x-y$.
Substituting equation (2) into $x y+y z+x z+y=0$, we get $x^{2}+y^{2}+x y-y=0$.
From equation (1), we get $x=-\frac{1}{y}$, substituting into equation (3) and simplifying, we get $(y-1)\left(y^{3}-y-1\right)=0$.
It is easy to see that $y^{3}-y-1=0$ has no rational roots. Therefore, $y=1$. From equation (1), we get $x=-1$.
From equation (2), we get $z=0$, which contradicts $z \neq 0$.
In summary, the system of equations has two rational solutions:
$$
(x, y, z)=(0,0,0),(-1,1,0) .
$$