Let $(X,\mathcal{O}_X)$ be a locally ringed space, and $f\in\mathcal{O}_X(X)$. Show that $$D=\{x\in X\mid f(x)\neq0\in\kappa(x)\}\subset X$$ is an open subset. What is $D$ in the case of $X=\operatorname{Spec}(A)$?
What I have come up with so far is if $x\in D$ then locally near $D$ we will get a $g$ so that $fg=1$. So, locally $f(x)\neq0$.
Am I on the correct path? But I am struggling to use that idea to figure out a formal proof based on my idea.
Can somebody help me?