The property that every coherent sheaf admits a surjection from a coherent locally free sheaf is also known as the resolution property.
The theorem can be refined as follows:
Every noetherian, locally $\mathbb Q$-factorial scheme with affine diagonal (equiv. semi-semiseparated) has the resolution property (where the resolving vector bundles are made up from line bundles).
This is Proposition 1.3 of the following paper:
Brenner, Holger; Schröer, Stefan
Ample families, multihomogeneous spectra, and algebraization of formal schemes.
Pacific J. Math. 208 (2003), no. 2, 209--230.
You will find a detailed discussion of the resolution property in
Totaro, Burt.
The resolution property for schemes and stacks.
J. Reine Angew. Math. 577 (2004), 1--22
Totaro proves in Proposition 3.1. that every scheme (or algebraic stack with affine stabilizers) has affine diagonal if it satisfies the resolution property.
The converse is also true for smooth schemes:
Proposition 8.1 : Let $X$ be a smooth scheme of finite type over a field. Then the following are equivalent:
- $X$ has affine diagonal.
- X has the resolution property.
- The natural map $K_0^{naive} \to K_0$ is surjective.
You can, if you use a slightly more general notion of gluing. (The notion of gluing you present is "wrong", or at least simplistic, in roughly the same way that it is "wrong" to require that a basis for a topology be closed under intersections. E.g., if you do this, then the set of open balls in $\mathbb{R}^n$ for $n > 1$ does not form a "basis.")
Let $X$ be a scheme. Consider the diagram whose objects are open affine subschemes of $X$, and whose morphisms are inclusions $U \hookrightarrow V$ such that $U$ is a distinguished open subset of $V$. Whenever $U$ and $V$ are two objects and $x \in U \cap V$, there exists an object $W \subset U \cap V$ such that $x \in W$ and $W \hookrightarrow U$, $W \hookrightarrow V$ are both morphisms: Since the distinguished open subsets of $U$ form a basis for the topology, there is a distinguished open $W'$ in $U$ such that $x \in W' \subset U \cap V$. Similarly, there is a section $f$ over $V$ such that $x \in V_f \subset W'$. But then $V_f = W'_f$ is a distinguished open subset of both $U$ and $V$, so we let $W = W'_f$.
It is also not too hard to show that whenever we have a category as above, we can glue things together to form a scheme (i.e., the diagram has a unique colimit in the category of schemes). If someone asks for a precise statement of this, I'll try to cook one up, but it's not particularly nice. (Not quite horrendous, but not very nice either.)
In particular, the fiber product is obtained by gluing together schemes of the form $\mathrm{Spec} A \otimes_C B$, where $\mathrm{Spec} C$ contains the images of both $\mathrm{Spec} A$ and $\mathrm{Spec} B$, with "overlap inclusions" specified by morphisms
$A \otimes_C B \to A_f \otimes_C B_g$. An important note here: if $C \to D$ is a ring epimorphism (e.g., corresponds to an open immersion), and $A, B$ are $D$-algebras, then $A \otimes_C B$ is naturally isomorphic to $A \otimes_D B$.
Best Answer
The necessary and sufficient condition on a schemes $\{U_i\}$ and gluing isomorphisms $\varphi_{ij}:U_{ij} \simeq U_{ji}$ between opens $U_{ij} \subset U_i$ ($i, j \in I$) that the gluing $X$ be separated is that the graph map $U_{ij} \rightarrow U_i \times U_j$ defined by $u \mapsto (u, \varphi_{ij}(u))$ is a closed immersion (or equivalently, has closed image) for all $i, j$. This is seen by intersecting $\Delta(X)$ with the opens $U_i \times U_j$ that cover $X \times X$.
(Taking $i=j$, this says that all $U_i$ are separated, which is automatic when all $U_i$ are affine; in such cases the closed immersion condition forces all $U_{ij}$ to also be affine, so in the context of the question one loses nothing by requiring all $U_{ij}$ to be affine open prior to stating the closed immersion condition.)