Is it possible that the product of two non-affine schemes becomes affine?

Question: Is there an example of some $X$ and $Y$ non-affine schemes, with $X \times_{\operatorname{Spec} \mathbb{Z}} Y$ affine?

Updated question (after Eric Wofsey's example): Is there an example of some $X$ and $Y$ non-affine $k$-schemes, with $X \times_{\operatorname{Spec k}} Y$ affine?

I can think of examples where we allow more general fiber products: we can intersect non-affine subschemes of projective space to get an affine scheme (for example take some affine plane without the origin embedded in $\mathbb{P}^2$ and intersect it with a projective line that doesn't meet that origin). So I mean in particular the product over $\operatorname{Spec} \mathbb{Z}$ (or $\operatorname{Spec} k$ for varieties).

I also know of a near example where the product is allowed to be "twisted" as in a fibration / locally a product, though in this case the fibers are affine, namely: $GL_2(\mathbb{C}) \to \mathbb{CP}^1$. (Here the map is the one induced by the natural action. The fibers are the invertible upper triangular matrices, etc.) (This example really can't be refined to an answer to my original question, for the reasons of the next paragraph.)

Another vague conclusion: Suppose that there is some map $X \to X \times_{\mathbb{Z}} Y$ which induced by the identity on $X$ and some map $X \to Y$ (lets say we are working with $k$-schemes and $Y$ has a $k$ point... or some other condition to guarantee that this map actually exists) which is a closed embedding - for example when $Y$ is separated (I think $Y$ has to be separated for this to be a closed embedding, but maybe I'm overthinking it: if $Y$ is separated, then $X \times_{\mathbb{Z}} Y \to X$ is separated, and $X \to X \times Y \to X$ is just the identity, so it is a closed embedding and so the Cancellation Theorem - 10.1.19 in Ravi - applies).

Then if the product is affine it must necessarily be the case that $X$ (and $Y$) have "a lot" of functions on them (relative to "the size" of $X$ and $Y$ - I'm drawing on the intuition that the only global sections on projective varieties are $k$). So they can't be, for example, projective varieties.

From this I want to say that an example (if it is exists) is likely to involve silly things like $\mathbb{A}^2$ (or I think more generally some $dim \geq 2$ Noetherian normal affine scheme minus some nonempty codimension $\geq 2$ set?). Or maybe part of the issue here is that my repertoire of non-affine schemes is limited to basically just quasi-projective varieties (and amusing pathologies built out of $\operatorname{Spec} k[x_0, x_1, \ldots]$)

Those are the thoughts I've had. I don't know a good way to measure non-affineness in general... Except that the higher cohomology of quasi-coherent sheaves should vanish.... but this is not something I really "know" yet, so I feel uncomfortable invoking it for now. I found via google that this is an iff criterion for affineness under nice conditions: http://mathoverflow.net/questions/153523/does-vanishing-of-cohomology-of-locally-free-sheaves-imply-affiness-of-scheme

So maybe some combination of Kunneth formula like computations would suffice to prove that this cannot happen (I am secretly thinking of the insight of this math overflow post: http://mathoverflow.net/questions/60375/is-mathbb-r3-the-square-of-some-topological-space ).

A kind of trivial example which is similar to your intersection example for general fiber products: if $K$ and $L$ are fields of different characteristic and $X$ is a non-affine scheme over $K$ and $Y$ is a non-affine scheme over $L$, then $X\times_\mathbb{Z} Y=\emptyset$ is affine.
Over a field $k$, however, this cannot happen. More generally, if $X$ and $Y$ are schemes over $k$ such that $Y$ is nonempty and $X\times Y$ is affine, then $X$ is affine. To prove this, choose a point $y\in Y$ and consider $X\times \operatorname{Spec} k(y)$. Since the inclusion $\operatorname{Spec} k(y)\to Y$ is an affine morphism, so is $X\times \operatorname{Spec} k(y)\to X\times Y$, and so $X\times \operatorname{Spec} k(y)$ is an affine scheme. Thus the projection $X\times \operatorname{Spec}k(y)\to\operatorname{Spec} k(y)$ is an affine morphism. Since affineness of morphisms is local on the base in the fpqc topology (see here, for instance), it follows that $X\to\operatorname{Spec} k$ is affine, and hence $X$ is an affine scheme. (The choice of a point $y$ here is just because in general, I don't think you can conclude that the projection $X\times Y\to Y$ is an affine morphism from the fact that $X\times Y$ is affine without some hypothesis on $Y$.)
Dear Eric: concerning your last sentence you are right. A sufficient hypothesis on $Y$ which would enable you to conclude that $X\times Y$ is affine would be that $Y$ is separated. – Georges Elencwajg Mar 29 at 19:20