I'm relatively new to schemes (just started Hartshorne chapter II), and the following question seemed natural to me but I could not determine an answer. Suppose $X$ is a separated scheme and $x,y$ are two distinct points in $X$. Is there always an open set $U\subset X$ containing $x,y$ and a function $f\in \mathcal{O}_X(U)$ so that $f(x)=0$ and $f(y)\neq 0$ (or the reverse)?
If $X$ is affine, say $\operatorname{Spec} A$, I think I understand why this has to be the case: saying $x\notin\overline{\{y\}}$ is the same thing as saying that the prime ideal corresponding to $y$ is not a subset of the prime ideal correpsonding to $x$, so we can pick some $f$ in the prime ideal corresponding to $y$ which isn't in the prime ideal corresponding to $x$, and this function vanishes at $y$ but not $x$. This also handles the case where $x,y$ are in a common affine open. But I don't know if $x,y$ are always in a common affine open.
Edit: Thanks to the comments (Jyrki Lahtonen and Tabes Bridges) for the advice about including the adjective separated.
Progress: The problem can be reduced to $X$ integral (if $x,y$ are in different irreducible components, then we can find disjoint neighborhoods and take an indicator function, and nilpotents don't affect the evaluation of functions). Since any two open sets of an irreducible space intersect and the intersection of two affine opens in a separated scheme is again an affine open, we may assume that $X$ is the union of $\operatorname{Spec} A_1$, containing $x$, and $\operatorname{Spec} A_2$, containing $y$, with intersection $\operatorname{Spec} B$ containing neither $x$ nor $y$. From here the global functions on $X$ are the functions in $A_1\times A_2$ which lie in the kernel of $A_1\times A_2\to B$ by subtracting the images of their components. I don't see how to get the desired function from this, though.