Extending YACP's example, we have the following general class of examples:

Let $R$ be a commutative ring with 1, $p$ a prime ideal, $I$ any ideal satisfying $p^2 \not \subset pI$ and $V(I) \cap \operatorname{Spec}(R_p) \subset \{p\}$ (viewing $\operatorname{Spec}(R_p) \subseteq \operatorname{Spec} R$). Then viewing $S := p/pI$ as a
non-unital ring gives an example of a nontrivial ring with no prime ideals (as long as $p$ has no idempotents modulo $pI$).

To see why, note that $p^2 \not \subset pI$ is equivalent to saying that multiplication in $S$ is nontrivial. Now any prime ideal of $S$ must come from a prime ideal of $R$, contained in $p$, and containing $pI$. By the assumption on $V(I)$, the only possible such prime is $p$ itself, which is not a proper ideal in $S$, so $S$ has no primes.

As an example, taking $I = p^n$, for $n \geq 2$ (note: $n = 1$ never works!), will satisfy the conditions above (as long as $p^2 \not \subseteq p^3$, e.g. $p^2 \neq 0$ is finitely generated). This recovers YACP's example with $R = \mathbb{Z}$, $p = 2\mathbb{Z}$, $n = 2$.

Notice that $2\mathbb{Z}/6\mathbb{Z}$ is not an example though: the element $4$ acts as a 1. So the assumption that $p$ has no idempotent mod $pI$ is not an empty statement. It seems to hold when $I = p^n$ and $R$ is Noetherian though, e.g. possibly by considering the order in a local ring (the largest power of the maximal ideal an element lies in) - can anyone provide a proof of this?

**Edit:** Suppose $R$ had a prime ideal $p$, such that $p/p^n$, $n \geq 3$, has an idempotent $x$. Replacing $R$ by $R_p$, we may assume that $p$ is maximal and $R$ is local. Then $x^2 - x = x(x-1) \in p^n$, but $1-x$ is a unit in $R$ (since $x \in p$), so $x \in p^n$, i.e. $x = 0$ in $p/p^n$. So the example $I = p^n$ does work (without Noetherian hypotheses).