Let $f$ be a function of three real variables, $(x, y, z)$ where $z$ is a function of $(x,y)$. By the chain rule on $f(x,y,z(x,y))$:
$$\frac{\partial{f}}{\partial{x}}=\frac{\partial{f}}{\partial{x}}\frac{\partial{x}}{\partial{x}}+\frac{\partial{f}}{\partial{y}}\frac{\partial{y}}{\partial{x}}+\frac{\partial{f}}{\partial{z}}\frac{\partial{z}}{\partial{x}}=\frac{\partial{f}}{\partial{x}}+\frac{\partial{f}}{\partial{z}}\frac{\partial{z}}{\partial{x}}$$
But this implies $\frac{\partial{f}}{\partial{z}}\frac{\partial{z}}{\partial{x}}=0$! Which of course can't be true. Something in my understanding is missing. Maybe these are different "kinds" of derivatives?
What is the solution to resolve the confusion?