maybe this is a stupid question, but I'm not seeing if this is true for some spaces (affines at least).
Let $K (X) = \varinjlim\limits_{\emptyset \neq U \in \text{Open}(X)} \mathcal{O}_X (U)$ be the function field for a locally ringed space (I'm specially interested in connected schemes) $(X, \mathcal{O}_X)$. Does $\mathcal{O}_X (U) =\bigcap_{x \in U} \mathcal{O}_{X, x} \in K (X)$ hold? If not, in general (by this I mean a class of examples), when this is true?
I know it holds for the spectrum of integral domains and affine varieties. Maybe the space must be irreducible...
Thanks in advance.
Your definition of $K(X)$ isn't meaningful if $X$ is not irreducible. Actually, even if $X$ is irreducible, it is not correct; you need to restrict to non-empty $U$ (otherwise the direct limit is just equal to $\mathcal O_X(\emptyset)$, which is $0$). Now if $X$ is not irreducible, there will be non-empty open sets $U$ and $V$ whose intersection is empty, and so the direct limit over non-empty open sets won't be directed. So you should restrict to irreducible $X$.
But if $X$ is not also reduced, then the maps $\mathcal O(U) \to K(X)$ need not be injective; there can be nilpotents that are supported on embedded components. (Consider the ring $A := \mathbb C[x,y](xy,y^2)$, taking $U = X =$ Spec $A$.) So for the statement you ask about, you need to stick to schemes $X$ that are irreducible, and have no embedded components, the most basic examples of which are integral schemes.