Let me just give the proof I found from a book, which seems incomplete:
First, for a particular value of $r\in\mathbb R$, $f^{-1}(]r-\frac{1} {k},r+\frac{1}{k}[), k\in\mathbb Z_{++}$ is an open subset of $\mathbb R^\omega$, which, under the product topology, is of the form $\mathcal O_k\times\mathbb R^\omega$, where $\mathcal O_k$ is an open subset of $\mathbb R^{n_k}$ for some $n_k\in\mathbb Z_{++}$.
Now, for any $k'>k$, we have $f^{-1}(]r-\frac{1}{k'},r+\frac{1}{k'}[)\subset f^{-1}(]r-\frac{1}{k},r+\frac{1}{k}[)$, and therefore "it is easy to deduce that" for any $f(x,y)=r$, we have $x\in\mathcal O_k$ and $y$ is any point in $\mathbb R^\omega$, and therefore, $f(x,y)=f(x)$ locally.
My problem with the last deduction is that: as we shrink the interval centered at $r\in\mathbb R$, the preimage of the interval may involve different (though finite) number of coordinates, for example, an increasing number of coordinates. It is not so obvious this remains finite when we take the limit $k\to\infty$. I have checked Wilansky and Munkres and didn't find an answer (Munkres is more obsessed with maps into products).
Any suggestion or references are welcome.