If one needs to go to the bathroom, one should not recite the Amida, as the feeling is distracting. It is also not proper to approach God in prayer when one’s body is full of waste. If a person started reciting the Amida when one badly needed to move his bowels, the Amida is invalid, and one must repeat the prayer after relieving oneself. Other blessings and prayers are not treated as strictly as the Amida, and are not invalidated after the fact. If the need to go is not very strong, and one could have waited for over an hour, the Amida is kosher.
Someone drunk is not allowed to recite the Amida, because praying demands being clear-headed. In this we differ from those pagans who prefer ecstatic worship aided by drugs and alcohol. In contrast, we turn to God when we are sober and capable of deep thought. For this reason, priests were not allowed to enter the Temple drunk (Leviticus 10:8-11). When people have had enough alcohol to make themselves dizzy, but still able to speak respectfully to a king, their Amida is acceptable. If they are drunk enough that they would be unable to address a king properly, their Amida is invalid. Nevertheless, blessings may be recited even by someone drunk.
One may not speak or even think words of prayer or Torah in the presence of a bad smell (such as excrement or a dead animal) or when looking at body parts supposed to be covered. If a man can see another man, or a woman can see another woman, the prohibition applies only if the genitals are exposed. But if a man can see a woman, he is not allowed to pray or learn Torah even if he can see only a handsbreadth of a part of her body that is supposed to be covered.