This little piece of halacha seems like it should be obvious, but maybe that's just me.
Don't daven or say a bracha around a foul smell.
As a practical matter in shul, this usually relates to passing gas. If you really need to do that, go outside for a minute. Halachically, everyone around you should stop davening until the smell dissipates. So if you break wind in shul, that's just rude. (And disrespectful, etc, etc...)
Similarly, don't daven or make a bracha beside a trash can, bathroom, or other smelly place. I've seen some say that the "rule" is standing approximately 6ft away from the bathroom or a trash can. I can neither confirm nor deny, but I'm sure commenters can clarify that.
Likewise, if you notice that people in shul don't want to daven near you, you may have a body odor issue...