You can find such elements in a non-UFD. In UFD, every irreducible element is a prime element though.
Now, take some non-UFD examples.
Consider , where F is a field. Then, (Note: the parenthesis here is not denoted for an ideal ). We see that , but it does not imply either or . Thus xy is not a prime element. However, xy is an irreducible element in D. For example, if , then you see that 1/3 is a unit here and xy is not factorized in this domain.
As per your example, is not a prime element, but it is an irreducible element. You cannot factorize = ab unless a or b is a unit in .
(ps: if one day I understand everything in abstract algebra, surely I will rewrite the book)