The one who is praying is conversing with his Lord, as the Messenger of Allaah (peace and blessings of Allaah be upon him) said: “When one of you stands to pray, he is conversing with his Lord” Narrated by al-Bukhaari (390) and Muslim (762). So he should be fully prepared for standing before his Lord, and his body and clothes and the place where he prays should be clean and free of any offensive smells. Allaah says (interpretation of the meaning):
“O Children of Adam! Take your adornment (by wearing your clean clothes) while praying [and going round (the Tawaaf of ) the Ka‘bah] and eat and drink but waste not by extravagance, certainly He (Allaah) likes not Al‑Musrifoon (those who waste by extravagance)”
So the worshipper is enjoined to adorn himself and look presentable when praying.
And the Prophet (peace and blessings of Allaah be upon him) said: Were it not for the fact that I did not want to make things too hard for my ummah, I would have commanded them to use the siwaak at every time of prayer.” Narrated by al-Bukhaari (838)and Muslim (370).
With regard to the validity of prayer when there is an unpleasant smell in the mouth, it is valid but it is makrooh (disliked).
If the prayer is offered in the mosque and this smell is obvious to such an extent that it annoys other worshippers and the angels, then it is haraam. Al-Bukhaari (806) and Muslim (870) narrated that the Prophet (peace and blessings of Allaah be upon him) said: “Whoever has eaten of this plant (i.e., garlic), let him not approach our mosque.”
And he (peace and blessings of Allaah be upon him) said: “Whoever has eaten of this plant let him not approach our mosque and annoy us with the smell of garlic.” Narrated by Maalik in al-Muwatta’ (27).
Our advice is to pay attention to cleaning your mouth, and if it needs some treatment then have it treated so that you will not be embarrassed and keep away from prayer in congregation.
And Allaah knows best.