Let $X$ be a scheme. Does there exist an open immersion $X\rightarrow Y$ with $Y$ quasicompact?

$\begingroup$ What about if $X$ is an infinite disjoint union of points? $\endgroup$ – Sam Gunningham May 2 at 17:06

5$\begingroup$ @SamGunningham if you are talking about a countably infinite disjoint union of $\mathrm{Spec}\,k$ for $k$ a field, then I believe there is an open immersion into the affine scheme $\mathrm{Spec}\, \prod_i k$. Maybe I am wrong. $\endgroup$ – user138661 May 2 at 17:12

$\begingroup$ Ah good point. I hadn't considered that that would be an open immersion... $\endgroup$ – Sam Gunningham May 3 at 10:28
Here are two types of counterexamples. They are all locally of finite type over a fixed field $k$. They rely on the following trivial fact: If $X$ is a subscheme of $Y$ and $Y$ is covered by $n$ open affines, then $X$ (and of course every subscheme of $X$) is covered by $n$ open subschemes which are embeddable in affine schemes, in particular separated.
 Nonseparated examples:
For each set I, let $(L_i)_{i\in I}$ be a family of copies of (say) the affine $k$line, with $l_i$:= the origin of $L_i$ and $U_i:=L_i\smallsetminus\{l_i\}$. Let $X_I$ be obtained by gluing all the $L_i$'s along the $U_i$'s. A separated open subscheme of $X_I$ cannot contain more than one of the $l_i$'s. So if $I$ is infinite, $X_I$ has no finite cover by separated opens.
The above example is not quasiseparated, but a quasiseparated variant is $X=\coprod_{n≥1}X_{\{1,...,n\}}$.  A separated example: just take $X=\coprod_{n≥0}\mathbb{P}^n_k$.
Indeed, if $U\subset\mathbb{P}^n_k$ is embeddable in an affine scheme (i.e. $U$ is quasiaffine, since it is quasicompact) then its complement in $\mathbb{P}^n_k$ contains a hypersurface: otherwise we would have $H^0(U,\mathscr{O}_U)=k$ or $0$. Thus, if $\mathbb{P}^n_k$ is covered by $N$ quasiaffine opens we must have $N≥n+1$ since the intersection of $≤N$ hypersurfaces is nonempty.
EDIT prompted by @schematic_boi's comment:
 An irreducible and separated example: This comes from Qing Liu's answer to this question. Start with the affine line $L=\mathrm{Spec}(k[t])$ over $k$. For each closed point $x\in L$, put $L_x:=\mathrm{Spec}(\mathscr{O}_{L,x})$. For each set $S$ of closed points, let $X_S$ be the scheme obtained by gluing all schemes $L_x$ ($x\in S$) at their common generic point $\eta$ (this is a scheme because $\{\eta\}$ is open in each $L_x$). As Liu observes, this is an irreducible separated scheme. Let us also observe that $\Gamma(X_S,\mathscr{O}_{X_S})=:R_S\subset k(t)$ is the ring of rational functions defined at each $x\in S$. Also, if $T\subset S$ there is a natural open immersion $X_T\hookrightarrow X_S$; in particular (for $T=\emptyset$) $\{\eta\}$ is open in $X_S$.
Now assume $S$ infinite (e.g. all closed points, for infinite $k$). Assume there is an open immersion $j:X_S\to Y$ where $Y$ is quasicompact. Taking a finite affine covering of $Y$, we see that for some infinite subset $T$ of $S$, $j(X_T)$ is contained in an affine open subset. Replacing $S$ with $T$, we may assume $Y=\mathrm{Spec}(A)$ affine. Since $\{j(\eta)\}$ is open in $Y$, there is $f\in A$ such that $j(\eta)\in D(f)\subset\{j(\eta)\}$ and therefore $f$ vanishes at each closed point of $X_S$. In other words, the image of $f$ in $R_S\subset k(t)$ vanishes at infinitely many closed points but not at $\eta$, which is absurd.

1$\begingroup$ Do you have anything to say about this question: mathoverflow.net/q/331168/138661 ? $\endgroup$ – user138661 May 20 at 7:54

$\begingroup$ No. I don't know much about spectral spaces. $\endgroup$ – Laurent MoretBailly May 20 at 8:09

$\begingroup$ is there an irreducible separated scheme locally of finite type over a field that has this property? One could do some glueing (e.g. mathoverflow.net/q/34620/138661) but I do not see exactly how. $\endgroup$ – user138661 May 20 at 11:25
As noted in the answer by Manny Reyes to the mathOverflow question Can any topological space be the result of a scheme?, Hochster showed, in Theorem 16 of his Annals paper Prime ideal structure in commutative rings, that the topological spaces that arise from (separated) schemes are exactly the open subsets of spectral spaces. In the same paper, he also showed that spectral spaces are exactly the underlying topological spaces of affine schemes, and that the topological spaces arising from schemes are exactly the locally spectral spaces. (Hochster used the word "scheme" for what we call today "separated scheme," and "prescheme" for what we call a "scheme.") This doesn't seem to exactly answer your question. But it would seem to make it a lot more difficult to find a counterexample (if there is one).

$\begingroup$ Mr. Clark corrects Mr. Reyes' answer apparently. And then somebody corrects him in the comments. Confusing. $\endgroup$ – user74900 May 3 at 1:47

$\begingroup$ I didn't read that whole thread with Reyes' answer, but I did notice that Hoechster is using "scheme" for what we call "separated scheme" today. So I edited my answer to reflect that. At any rate, I'm not sure if Hoechster's techniques would be useful to answering the OPs question or not. $\endgroup$ – Patrick May 3 at 2:16