I am reviewing my commutative algebra and as part of the process I am doing a very long and detailed proof of the fact that the prime ideals of $k[x,y]$ are $(0)$, $(f)$ with $f$ an irreducible polynomial, and the maximal ideals ($k$ is a field). Please notice that I do not want an alternative or complete proof; I just want to be sure of when are certain hypothesis needed.
One of the things that I need to prove is that a principal prime ideal in $k[x,y]$ is generated by an irreducible polynomial. I am aware that $k[x,y]$ is an UFD, but I am wondering if I could use a slightly less strong fact to prove it and only use that it is an ID. I would do the following: $f = f_1f_2 \Longrightarrow f_1\in (f) \mbox{ or }f_2\in (f)$ (assume the first). Then $f_1 = q_1f \Longrightarrow f = fq_1f_2$ and now using that we are in an ID (and we can "divide") we get that $q_1f_2=1$ so $f_2$ is a unit and thus $f$ is irreducible. My question is: am I using that I am in an UFD without noticing it?
Let's now get into the second question. At this point I have proved that $f_1, f_2$ have no common factors in $k(x)[y]$. This last ring is a PID, and $\gcd(f_1,f_2)=1$. Thus there must exist $a,b\in k(x)[y]$ such that $af_1+bf_2=1$. Do I need the fact that I am in a PID to conclude this? Why?
When I say "ring" below, I mean "commutative unital ring."
First quesstion: your argument that a principal prime ideal is generated by an irreducible does not require unique factorization, it only requires that your ring have no zero divisors. In fact, your argument is the standard one to show that a prime element in a ring with no zero divisors is necessarily irreducible, or that a principal prime ideal is generated by an irreducible. Recall that a prime element in a not necessarily commutative ring is an element $a$ such that $(a)$ is a prime ideal, which in a commutative ring is equivalent to asking that $a$ not be a unit and have the "prime divisor property": if $a\mid pq$, then either $a\mid p$ or $a\mid q$. There is a bunch of connections between irreducible, prime, indivisible, and more in more general contexts in this mathoverflow post. Lack of zero divisors suffices, you do not need unique factorization.
You do need that the ring have no zero divisors, however: consider $\mathbb{Z}/6\mathbb{Z}$. In this ring, $2$ is prime. Indeed, moding out by the ideal generated by $2$ gives the field $\mathbb{Z}/2\mathbb{Z}$, so $(2)$ is a prime ideal. But it is not irreducible, as $2=2\times 4$, and neither $2$ nor $4$ are units. In fact, the ring has no irreducibles.
And of course, it is well known that even in an integral domain you may have irreducibles that are not prime: the classical example is $\mathbb{Z}[\sqrt{-5}]$, where $2$, $3$, $1+\sqrt{-5}$, and $1-\sqrt{-5}$ are all irreducible, non-associates, yet $2\times 3 = (1+\sqrt{-5})(1-\sqrt{-5})$, showing that none of them are prime elements.
Second question: to conclude that if $f_1$ and $f_2$ have no common divisors then you can express $1$ in the form $f_1p + f_2q$ requires that the ideal $(f_1,f_2)$ be principal. A ring in which the gcd of any two elements can be expressed as a linear combination of the two elements is called a Bézout domain. This is equivalent to asking that all finitely generated ideals be principal; this is slightly weaker than PID (the ring of all algebraic integers is not a PID, but every finitely generated ideal is principal).
The way the argument actually goes "behind the scenes" is as follows: because $f_1$ and $f_2$ have no common divisors (other than units), but $(f_1,f_2)$ is principal, we have $(f_1,f_2)=(q)$ for some $q$, which means $q\mid f_1,f_2$. So $q$ must be a unit, and therefore $(f_1,f_2)=(1)$. That means $1\in (f_1,f_2)$, so we can express $1$ in the form $f_1p+f_2q$ for some $f_1$ and $f_2$ in our ring.
In a general ring, if $f_1$ and $f_2$ are elements, then $(f_1,f_2)=(q)$ if and only if $q$ is a common and can be expressed in the form $q=f_1a+f_2b$. Indeed, if $(q)=(f_1,f_2)$, then $q$ is a common divisor of $f_1$ and $f_2$; and by the argument above, we can express $q$ in the desired form. Conversely, if $q=f_1a+f_2b$ and is a common divisor of $f_1$ and $f_2$, then we know that $q\in (f_1,f_2)$ thanks to the expressability, giving $(q)\subseteq (f_1,f_2)$; and because $q\mid f_1$ and $q\mid f_2$ we get $(f_1,f_2)\subseteq (q)$, yielding equality.
And we always have:
Lemma. Let $R$ be a commutative unital ring, and let $a,b\in R$. If $x$ is a common divisor of $a$ and $b$, and $x$ can be expressed in the form $x=ar+bt$ for some $r,t\in R$, then $x$ is a greatest common divisor of $a$ and $b$.
Proof. Let $y$ be any common divisor of $a$ and $b$. Then $y$ divides $ar+bt=x$. Therefore, we have that $x\mid a$ and $x\mid b$ (beecause it is a common divisor); and if $y\mid a$ and $y\mid b$, then $y\mid x$, proving that $x$ is a greatest common divisor of $a$ and $b$. $\Box$
You do need that $(f_1,f_2)$ is principal, however. In $\mathbb{Z}[x]$, which is a UFD (and therefore a GCD domain) as a consequence of Gauss's Lemma, the ideal $(2,x)$ is not principal. Note that $2$ and $x$ are both irreducible, and have no common divisors other than units (which are $1$ and $-1$). But you cannot express $1$ is the form $2p+xq$, as any element of $(2,x)$ is a polynomial with even constant term.