The Gemara (עבודה זרה לה) writes that Rebbi was visiting his students and he saw that they did not have bread to eat. Rebbi asked them “Do you not have bakers in this town?”. There are two opinions about what Rebbi meant to ask; either Rebbi was merely asking where were the Jewish bakers. Alternatively, Rebbi was asking that if there was no bread available from a Jewish baker, why didn’t they buy bread from a non-Jewish baker. The Gemara says that even if Rebbi was saying that they were permitted to buy pat akum this would only be permitted under certain conditions. Rabbi Chelbo says it is permitted when there is no bread available from Jewish bakers, and Rabbi Yochanan says it is permitted when one is traveling.
There are three opinions amongst the rishonim regarding when pat akum is permitted. The Ran (מובא בב”י סימן קיב) writes that Rabbi Chelbo and Rabbi Yochanan agree with each other, and therefore one may eat pat akum when there is no bread available from a Jew, or if they are traveling. The Rambam (מאכלות אסורות פרק יז הל’ יב) writes that one requires both conditions to eat pat akum. One must be out of the city and there also must be no pat yisrael available. Tosfot (עבודה זרה לה ד”ה מכלל) writes that this prohibition was never accepted by the public and therefore pat akum is always permitted.
The Shulchan Aruch rules that one may buy pat palter if there is no pat yisrael available. The Rama rules more leniently, like Tosfot, that pat palter is always permitted, even if pat yisrael is readily available.
The Shach (שם ס”ק יב) writes that even for ashkenazim it is proper to be stringent like the Shulchan Aruch, especially during the Ten Days of Repentance between Rosh Hashanah and Yom Kippur. The Mishna Berura (סי’ רמב ס”ק ו) rules like the Shach.
Rabbi Moshe Feinstein (אגרות משה יו”ד ח”ב סימן לג) writes that we rule like the Rama, and pat palter is always permitted.
Situations That Permit Pat Palter
The Shulchan Aruch writes that even though pat palter is not permitted when pat yisrael is available, there are several situations when one may eat pat palter. These circumstances would permit pat palter year-round even according to the Shach and those that are careful not to buy pat palter during the Ten Days of Repentance or for Shabbat.
The first case that Shulchan Aruch brings (שם סעיף ג) is when pat yisrael is not easily available. The Chelkat Binyamin (סימן קיב ס”ק יט) explains that this means there is no bread available from a Jewish baker, and even though there may be bread from a private person available you are not required to go get from the private person to avoid buying pat palter. The Darkei Teshuva (ס”ק כט) writes that even when pat yisrael is available, if there is not enough for all the Jews of the city, it is considered as if there is no pat yisrael available and one may buy pat palter.
The Darkei Teshuva (ס”ק כו) points out that once we permit purchasing pat palter, one may buy and eat as much as they wish, we do not limit the permissibility to the minimum amount necessary.
Another instance when pat palter is permitted (שו”ע יו”ד סי’ קיב סעיף ה) is when the pat palter is of better quality than the pat yisrael, or is a different kind of product which is unavailable in pat yisrael form. Since the pat palter is better or a different kind it is considered as if that bread is unavailable in pat yisrael.
The Chelkat Binyamin (סי’ קיב סעיף ב) notes that when one is traveling, even the Shach would permit eating pat palter, whether pat yisrael is available or not.
 יש כמה שהחמירו בזה, עיין פר”ח ס”ק ט וערוך השלחן סעיף ט