Are schemes pushouts of neighbourhoods and formal neighbourhoods? Hello,
I have two questions, the first less important.
Let $X$ be a scheme, $x \in X$ a schematic point.

What is an elegant way of defining/characterizing the map $\operatorname{Spec}(O_{X,x}) \to X$?

This map can be defined by choosing affine neighbourhood, building the map and then showing independence; maybe there is a better way? For example a characterization which will make sense for locally ringed spaces (but existence perhaps will not be in that generality).
Now, suppose furthermore that $X$ is integral, $x \in X$ is a closed point, $U=X-\{x\}$. We denote by $K$ the field of rational functions on $X$, i.e. stalk at the generic point.
$$
\begin{matrix} \operatorname{Spec}(K) & \to & U \\\\ \downarrow & & \downarrow \\\\ \operatorname{Spec}(O_{X,x}) & \to & X \end{matrix}
$$

Is it true that this diagram is cartesian and co-cartesian?

If one can require more to get the result then it is also interesting (say pushout is in the category of schemes of certain type, or $X$ is a non-singular curve over a field...).
Thanks,
Sasha
 A: As for the first question: Let us define a pointed scheme be a pair $(X,x)$, consisting of a scheme together with some point $x \in X$. Morphisms of pointed schemes are defined in an obvious way. Thus we get the category of pointed schemes. Also, we have the category of local rings with local ring homomorphisms. Then we have a functor
$\mathrm{Spec} : (\text{local rings})^{op} \longrightarrow (\text{pointed schemes})$
which maps a local ring $(A,\mathfrak{m})$ to the pointed scheme $(\mathrm{Spec}(A),\mathfrak{m})$. In the other direction, we have a functor
$\mathrm{Stalk} : (\text{pointed schemes}) \to (\text{local rings})^{op}$
which maps $(X,x) \mapsto \mathcal{O}_{X,x}$. Now Proposition 2.4.4. in EGA I may be reformulated as:
Proposition: $\mathrm{Spec}$ is left adjoint to $\mathrm{Stalk}$.
The counit of this adjunction is the canonical morphism $i : \mathrm{Spec}(\mathcal{O}_{X,x}) \to X$ for a pointed scheme $(X,x)$ and the unit is the isomorphism $\mathcal{O}_{\mathrm{Spec}(A),\mathfrak{m}} \cong A_{\mathfrak{m}} \cong A$ for a local ring $(A,\mathfrak{m})$. So in more down-to-earth terms: $i$ is the universal morphism from the spectrum of a local ring to $X$ which maps to the closed point to $x$.
I doubt that for a pointed locally ringed space we have a morphism at all $\mathrm{Spec}(\mathcal{O}_{X,x}) \to X$. The reason is that the stalks of the structure sheaf are not sufficiently tied up together: There is no way of getting from prime ideals of the single local ring $\mathcal{O}_{X,x}$ to other points of $X$. You might try a topological (smooth) manifold with its sheaf of continuous (smooth) functions $(X,\mathcal{O}_X)$; see also this recent MO discussion about prime ideals in $\mathcal{O}_{X,x}$ in this example.
A: For simplicity, put $X_x=\mathrm{Spec}(\mathcal{O}_{X,x})$ and $X'_x=X_x\setminus\{x\}$.  
As was pointed out in name's answer, the diagram in the question is not cartesian in general. However, if we replace $\mathrm{Spec}(K)$ by the punctured spectrum $X'_x$, we get
$$\begin{array}{ccc}
X'_x & \longrightarrow & U\\
\downarrow & & \downarrow\\
X_x & \longrightarrow & X
\end{array}$$
which is trivially cartesian (no assumption on $X$ or $x$ here).  
If, moreover, you assume that $\{x\}$ is defined by finitely many equations (in some affine neighborhood) then the natural map $X_x\coprod U\to X$ is (faithfully flat and) quasicompact, which by flat descent implies that our diagram is also cocartesian. (This works in particular if $X$ is locally noetherian.)
If it is cocartesian and $X$ is integral, and you work in the category of separated schemes, then your original diagram is also cocartesian, because if two morphisms from $X'_x$ to a separated scheme $Z$ coincide on $\mathrm{Spec}(K)$, they must be equal by density.  
Apart from these cases I don't have a general answer. An interesting special case is when $X=\mathrm{Spec} k[(x_n)_{n\in\mathbb{N}}]$ ($k$ a field), and $x$ is the origin. In this case, the natural map $X'_x\coprod U\to X$ is not a topological quotient map! In other words, the above diagram is not cocartesian as a diagram of topological spaces. However, I could not prove that it is not cocartesian as diagram of schemes.
A: How about this: $Spec (\mathcal{O}_{X,x})$ is the sub-locally ringed space of $X$ whose underlying topological space consists of all the points $y$ of $X$ such that $x$ is in the closure of $y$.
The square is not cartesian unless $X$ has dimension one. Open immersions are preserved by pull-back and so the pullback would be the open subscheme of $Spec(\mathcal{O}_{X, x})$ which is the complement of $x$. If you replace $Spec(K)$ with the pull-back, the square is not cocartesian, due to the existance of non-separated phenomena, like the affine line with a double origin.
