Bhagavad Gita: Chapter 13, Verse 33

यथा सर्वगतं सौक्ष्म्यादाकाशं नोपलिप्यते |
सर्वत्रावस्थितो देहे तथात्मा नोपलिप्यते || 33||

yathā sarva-gataṁ saukṣhmyād ākāśhaṁ nopalipyate
sarvatrāvasthito dehe tathātmā nopalipyate

yathāas; sarva-gatamall-pervading; saukṣhmyātdue to subtlety; ākāśhamthe space; nanot; upalipyateis contaminated; sarvatraeverywhere; avasthitaḥsituated; dehethe body; tathāsimilarly; ātmāthe soul; nanot; upalipyateis contaminated

yatha sarva-gatam saukshmyad akasham nopalipyate
sarvatravasthito dehe tathatma nopalipyate

Translation

BG 13.33: Space holds everything within it, but being subtle, does not get contaminated by what it holds. Similarly, though its consciousness pervades the body, the soul is not affected by the attributes of the body.

Commentary

The soul experiences sleep, waking, tiredness, refreshment, etc., due to the ego that makes it identify with the body.  One may ask why changes in the body in which it resides do not taint the soul.  Shree Krishna explains it with the example of space.  It holds everything, but yet remains unaffected, because it is subtler than the gross objects it holds.  Similarly, the soul is a subtler energy.  It retains Its divinity even while It identifies with the material body.