The Chofetz Chaim went on a complete tangent off of lashon hara, to discuss in more detail the concept of unintentionally doing a prohibition in cases where you seemingly have no choice in the matter. He focuses on idolatry. Specifically the prohibition of benefiting from seeing idols or even there temples and services as well as listening to music sung or played at there services and the sweet smells that come from those services. The Chochmas Adam seems to say that if a person does not close his eyes or his ears or his nostrils when passing by a place of idol worship, even if he has no intent of benefiting and this was let say the only way to get to work, it is still prohibited to go that way if you don’t close your eyes, nose, and/or ears because there is an automatic guarantee that he will be doing something wrong.
The Chofetz Chaim disagreed on his premise that a person walking that way will automatically do something wrong because since he can potentially close his eyes, or at least squint so he can see where he is going without easily seeing what’saroind him, or stop up his nostrils to the point he can still breathe but cannot smell well, or put his finger in his ear is enough to get rid of the automatic wrongdoing notion. Though he does actively walk to the area of problem but his walking doesn’t combine with the passive sense of smelling, seeing or hearing if he does not want to benefit from it and had no intention of wanting to benefit from it, since the potential to avoid the forbidden thing is there, that makes it not automatic. However the Chofetz Chaim did say that let say the music is blasting so loud, or the smell is overwhelmingly sweetly pungent or it is right in front of you and you cannot avoid it by even potentially putting you fingers in your ears or squinting, or stopping up your nose with cotton or the like, then it is automatic and forbidden. Also if a person didn’t have any hands or finger so had no way of potentially using them then the prohibition is also automatic so it would be a problem. In summary if you can potentially avoid something wrong even if you don’t but you truly don’t want to get any benefit from the wrong thing and you have no intention to enjoy it, even if it just automatically comes your way it is still not a prohibition though it is always best to avoid and go around it if possible.