This thread (including comments from both Jeremy and Alex) was very useful to me in PhD Quals preparation.
I would like to give a detailed proof using Jeremy's and Alex's outline, but without mention of Spec(R), in case the reader is less algebraic-geometry-inclined.
Corrections welcome. Thanks.
Proposition. Let R be a UFD in which every nonzero prime ideal is maximal. Then R is a PID.
Lemma 1. If p is a nonzero irreducible element of R, then (p) is a prime ideal of R.
Proof. Let a and b be nonzero elements of R such that ab ∈ (p), i.e. ab = pf for some nonzero element f ∈ R. If a and b are both non-units, then we can write their unique factorisations a = up1...pr and b = vq1...qs for unique irreducible elements pi and qj, and units u and v ∈ R. By unique factorisation, p = one of the pi's, or p = one of the qj's, or both. Hence either a ∈ (p) or b ∈ (p) or both. [Similar reasoning works if either a or b is a unit of R.] Thus, (p) is a prime ideal.
Lemma 2. If I is a nonzero prime ideal of R, then I is principal.
Proof. Given a nonzero, proper prime ideal, $I$, with some element $r\in I$, write $r= p_1\cdots p_n$ as a product of primes. By the primality of $I$ we know some $p_i\in I$. Since $p_i$ is prime, by assumption $(p_i)$ is maximal, so $(p_i)\subseteq I$ implies that $I=(p_i)$.
Proof of Proposition.
Following Alex's thread, let N be the set of non-principal ideals in R. Suppose that N is non-empty. N is a partially ordered set (with inclusion of ideals being the ordering relation). Any totally ordered subset of ideals J1 ⊆ J2 ⊆ ... in N has an upper bound, namely J = ∪ Ji. J is an ideal of R because the subset was totally ordered. If J = (x) for some x ∈ R, then x ∈ Ji for some i, and hence (x) = Ji. Contradiction. Thus, J ∈ N and by Zorn's Lemma, N has a maximal element. Call it n.
By Lemma 2, we see that n is not a prime ideal of R. Thus, there exist a, b ∈ R, such that a, b ∉ n, but ab ∈ n. But then n + (a) and n + (b) are ideals in R which are strictly bigger than n, and so must be principal ideals, i.e. n + (a) = (u) and n + (b) = (v) for u, v ∈ R. Then we have
n = n + (ab) = (n + (a)) (n + (b)) = (u)(v) = (uv). Contradiction.
Thus, N must be the empty set, i.e. all ideals in R are principal.
In a unique factorization domain, if $b$ divides $a^n$, and $r$ is an irreducible that divides $b$, then $r$ also divides $a$.
To see this, you factor $a$ into irreducibles, $a=ur_1\cdots r_k$. Then the factorization of $a^n$ into irreducibles must be
$$a^n = u^n r_1^n\cdots r_k^n$$
because that is a factorization, and hence the factorization. If $b$ divides $a^n$ and $r$ divides $b$, then $r$ divides $a^n$, and hence there exists $c$ such that $rc=a^n$. Expressing $c$ as a product of irreducibles, and using unique factorization, we conclude that $r=r_i$ for some $i$, so $r$ actually divides $a$, and not merely $a^n$.
This chain of reasoning fails without unique factorization, even if the domain is atomic (every elements can be written as a product of irreducibles): for example, $\mathbb{Z}[\sqrt{-5}]$ is an atomic domain that is not a UFD. Let $b=2$, and let $a=1+\sqrt{-5}$. Using the norm map $N\colon \mathbb{Z}[\sqrt{-5}]\to\mathbb{Z}$, defined by
$$N(x+y\sqrt{-5}) = x^2+5y^2$$
it is easy to verify that both $a$ and $b$ are irreducible. It is also plain that $b$ does not divide $a$. But $b$ does divide $a^2 = -4+2\sqrt{-5}$. Thus, we have a situation in which an irreducible divides $b$ (namely $2$), and $b$ divides a power of $a$ (namely, $a^2$), but the irreducible does not divide $a$.
Thus, in the argument you quote, the claim that because $a$ and $b$ have no common irreducible factor, and $b$ divides $a^n$, it follows that $b$ is a unit does not follow without unique factorization. Your thinking in point 1 that you could deduce that is incorrect, because we cannot deduce that $b$ is not divisible by any irreducibles; that deduction comes from concluding that any irreducible factor of $b$ must also divide $a$, but as the example above shows, without unique factorization into irreducibles this assertion would not follow.
A different way to see the initial claim is that in a UFD irreducibles are prime: if $r$ is an irreducible and divides a product $xy$, then $r$ must divide either $x$ or $y$. If your ring is atomic but not a UFD, this does not hold. In $\mathbb{Z}[\sqrt{-5}]$, all of $2$, $3$, $1+\sqrt{-5}$ and $1-\sqrt{-5}$ are irreducibles, but none are prime since
$$2\times 3 = (1+\sqrt{-5})(1-\sqrt{-5}).$$
That's what sinks you.
Best Answer
The ring in question is $\{\frac{a}{b}\in\mathbb{Q} \mid b\text{ is odd}\}$, also known as $\mathbb{Z}_{(2)}$.
The key property of this ring is that $R^\times = \{\frac{a}{b}\in\mathbb{Q} \mid a\text{ is odd, }b\text{ is odd}\} = R\setminus 2R$, from which we can conclude that $2R$ is the unique maximal ideal.
Presumably, you have identified all the irreducible elements: there is only one (up to multiplication by a unit), namely $2$, and it is prime.
You do not need any fancy theorems to demonstrate, from here, that $\mathbb{Z}_{(2)}$ is a UFD. You just need to notice that any element $r\in R$ can be written in the form $r = u\cdot2^k$, where $u$ is a unit and $k\in\{0,1,2,\ldots\}$.