2 added 190 characters in body

Theorem 1: Let $R$ be an integral domain with field of fractions $K$, and $R \to A$ a homomorphism. Then $Spec(A) \to Spec(R)$ is an open immersion if and only if $A=0$ or $R \to K$ factors through $R \to A$ (i.e. $A$ is birational over $R$) and $A$ is flat and of finite type over $R$.

Proof: Assume $Spec(A) \to Spec(R)$ is an open immersion and $A \neq 0$. It is known that open immersions are flat and of finite type. Thus the same is true vor $R \to A$. Now $R \to K$ is injective, thus also $A \to A \otimes_R K$. In particular, $A \otimes_R K \neq 0$. Open immersions are stable under base change, so that $Spec(A \otimes_R K) \to Spec(K)$ is an open immersion. But since $Spec(K)$ has only one element and $Spec(A \otimes_R K)$ is non-empty, it has to be an isomorphism, i.e. $K \to A \otimes_R K$ is an isomorphism. Now $R \to A \to A \otimes_R K \cong K$ is the desired factorization.

Of course, the converse is not as trivial. It is proven in the paper

Susumu Oda, On finitely generated birational flat extensions of integral domains Annales mathématiques Blaise Pascal, 11 no. 1 (2004), p. 35-40

It is available online. In the section "Added in Proof." you can find some theorems concerning the general case without integral domains. In particular, it is remarked that in E.G.A. it is shown that

Theorem 2: $Spec(A) \to Spec(R)$ is an open immersion if and only if $R \to A$ is flat, of finite presentation and an epimorphism in the category of rings.

More generally, in EGA IV, 17.9.1 it is proven that a morphism of schemes is an open immersion if and only if it is flat, a (categorical) monomorphism and locally of finite presentation.

There are several descriptions of epimorphisms of rings (they don't have to be surjective), see this MO-question.

1

Theorem 1: Let $R$ be an integral domain with field of fractions $K$, and $R \to A$ a homomorphism. Then $Spec(A) \to Spec(R)$ is an open immersion if and only if $A=0$ or $R \to K$ factors through $R \to A$ (i.e. $A$ is birational over $R$) and $A$ is flat and of finite type over $R$.

Proof: Assume $Spec(A) \to Spec(R)$ is an open immersion and $A \neq 0$. It is known that open immersions are flat and of finite type. Thus the same is true vor $R \to A$. Now $R \to K$ is injective, thus also $A \to A \otimes_R K$. In particular, $A \otimes_R K \neq 0$. Open immersions are stable under base change, so that $Spec(A \otimes_R K) \to Spec(K)$ is an open immersion. But since $Spec(K)$ has only one element and $Spec(A \otimes_R K)$ is non-empty, it has to be an isomorphism, i.e. $K \to A \otimes_R K$ is an isomorphism. Now $R \to A \to A \otimes_R K \cong K$ is the desired factorization.

Of course, the converse is not as trivial. It is proven in the paper

Susumu Oda, On finitely generated birational flat extensions of integral domains Annales mathématiques Blaise Pascal, 11 no. 1 (2004), p. 35-40

It is available online. In the section "Added in Proof." you can find some theorems concerning the general case without integral domains. In particular, it is remarked that in E.G.A. it is shown that

Theorem 2: $Spec(A) \to Spec(R)$ is an open immersion if and only if $R \to A$ is flat, of finite presentation and an epimorphism in the category of rings.

There are several descriptions of epimorphisms of rings (they don't have to be surjective), see this MO-question.