The image of a finite type morphism of Noetherian Schemes either contains a dense open or its complement does (Vakil Exercise 7.4.L) Given
$\pi : Spec(A) \to Spec(B)$
with $B$ an integral domain, $A$ and $B$ noetherian, by generic freeness we may choose a nonzero $f \in B$ such that $A_f$ is free as a $B_f$-module.
The part I'm struggling to show is that if the rank of $A_f$ is nonzero then the image of $\pi$ contains $D_B(f)$.  It's clear to me in the case that the rank is finite, as then $\pi$ is the spec of a finite, and thus integral extension.  But it is certainly not the case that $\pi$ is integral in general, because $Spec(\mathbb{Z}[t] \to \mathbb{Z})$ satisfies our criteria.  I'm assuming that if $A = \oplus_RB$,  given $\mathfrak{q} \in Spec(B)$ we want to take $\oplus_R \mathfrak{q}$, which itself is the ideal generated by the image of $\mathfrak{q}$ in A, but I have not been able to show that this is in fact a prime ideal.
 A: I think I got it.
Since $A$ is free as a $B$-module we have $B \hookrightarrow A$ So we might as well take it as a subring.
Let $\mathfrak{q} \leq B$ be prime and let $S=B - \mathfrak{q}$.
Then
$S^{-1}A \cong \oplus_R B_{\mathfrak{q}} $
and in particular we still have an inclusion.
Furthermore, we find that $\oplus_R \mathfrak{q}B_{\mathfrak{q}} = I$ is a proper ideal in $A$ because if $\{\varepsilon_i\}_{i \in R}$ is a basis for $A$ and $m \in \mathfrak{q}B_{\mathfrak{q}}$ then
$(m\varepsilon_i) \varepsilon_j = m \Sigma b_{ijk} \varepsilon_k = \Sigma mb_{ijk} \varepsilon_k \in I$
and $I$ is clearly proper and closed under addition.
Thus I is contained in some maximal ideal $\mathfrak{m} \leq A$, and since $B_{\mathfrak{q}}/\mathfrak{q}B_{\mathfrak{q}}$ is a field, the morphism induced into  $A/
\mathfrak{m}$ is injective, so $\mathfrak{m} \cap B_{\mathfrak{q}} = \mathfrak{q}B_{\mathfrak{q}}$ and we're done.
A: Here's a shorter answer for when $A_f$ has nonzero rank as a $B_f$ module.
Since $A_f\newcommand\Spec{\operatorname{Spec}}$ is free as a $B_f$ module, the map $\Spec A_f \to \Spec B_f$ is surjective (it's faithfully flat). Thus $\Spec B_f$ is actually in the image of $\Spec A$, and $\Spec B_f$ is open and dense, since $\Spec B$ is irreducible.
Key lemmas:

  
*
  
*A flat morphism is faithfully flat if and only if it is surjective. Stacks 38.15 and Stacks 38.16
  
*Nonzero free modules are faithfully flat. CRing Project, Ch 15, pg. 3

I won't prove these facts here, since they can be found in any standard reference on homological algebra, and most references on commutative algebra. I've linked references.
