daf bit: B'rachot 22
It was taught in a baraita: if a man was standing saying the t'filah and he sees dung in front of him (not all prayer is inside nice clean buildings; workers in the field are still obligated to pray at set times), he should move forward far enough to place this at least four cubits behind him. If that's not possible, the g'mara says, he should move that far to the side instead. If he was praying and sees dung where he is standing, Rabbah says that even though he has sinned (through negligence?) his prayer is valid. Raba disagrees, saying that his prayer is an abomination. (22b)
(I'm not sure which way this one goes in the end. Fortunately the question does not have many opportunities to arise today.)