$f^{-1}\left(0\right)$ has a finite number of elements let's say $(x_1,y_1),(x_2,y_2),\ldots,(x_N,y_N)$.
Let $$R=\frac{1}{3}\min_{1\leq i < j\leq N}\sqrt{\left(x_j-x_i\right)^2+\left(y_j-y_i\right)^2}$$
and $$B_k=\{(x,y):\sqrt{(x-x_k)^2+(y-y_k)^2}<R\}\quad\text{for}\;k=1,2, \ldots,N$$
It follows $f$ vanishes at $(x_k,y_k)$ and for no other point of $B_k$. Since $f$ is continuous $f$ have the same sign for all $(x,y)\in B_k\backslash(x_k,y_k)$.
Let's suppose there are two points $(x_a,y_a)\in B_a$ and $(x_c,y_c)\in B_c$ such that $f(x_a,y_a)$ and $f(x_c,y_c)$ has opposite sign, let's say $f(x_a,y_a)<0<f(x_c,y_c)$. Let $g:[0,1]\longrightarrow \mathbb{R}$ be the function defined by $$g(t)=f(tx_c+(1-t)x_a,ty_c+(1-t)y_a)$$ $g$ is a continuous function, Mean Value Theorem implies there is $t_0\in [0,1]$ with $g(t)<0$ for $t<t_0$ (in some neighborhood around $t_0$) and $g(t)>0$ for $t>t_0$ (in some neighborhood around $t_0$). Then $f$ vanishes at $(t_0x_c+(1-t_0)x_a,t_0y_c+(1-t_0)y_a)$ and this point is not in $\{(x_1,y_1),(x_2,y_2),\ldots,(x_N,y_N)\}$. Hence $f$ have the same sign for all $(x,y)\in B_k\backslash(x_k,y_k)$ for $k=1,2,\ldots,N$.
By continuity of $f$ we conclude $f$ has the same sign for all $(x,y)\in\mathbb{R}^2\backslash f^{-1}\left(0\right)$.