Q. Regarding the questions if Hashem is everywhere including impure places, (2412-13), does this mean that following the Hagra’s opinion, one cannot think of Hashem’s presence when in a bathroom or mikve? Does shivisi Hashem not apply when one is in them?
A. Hochmas Shlomo (O.H. 85) writes that one may think of the presence of Hashem even in a bathroom. He proves the point from the Talmud (Yuma 7b) regarding the prohibition of wearing the tzitz by the Cohen Gadol in such places, although it requires constancy, as compared to the also continuous mitzva of Shivissi Hashem.
Nachal Eshkol explains that this is the intention of Shir Hayichud when saying Kol Tinofes or no dirt can sully You. Eretz Zvi (1; 62) maintains that we recite modeh ani when waking up and addressing Hashem even with unclean hands and body. Other Poskim agree (Mishne Sochir 2: 23, Lev Avrohom 53, etc.
However, different Poskim disagree and maintain that one should not think of Hashem’s presence when in impure locations. (Lehoros Nossan 1:1, Tzitz Eliezer 13: 1, etc).
Horav Shlomo Miller’s Shlit’a opinion is that it is permitted.
Rabbi A. Bartfeld as revised by Horav Shlomo Miller Shlit’a