Sunan an-Nasa'i, Volume 1, Book 3, Hadith 388 (DarusSalam)

It was narrated from 'Aishah: "The Messenger of Allah used to put his head out of the Masjid while he was performing I'tikaf, and I would wash it, while I was menstruating."

أَخْبَرَنَا قُتَيْبَةُ، قَالَ حَدَّثَنَا الْفُضَيْلُ، - وَهُوَ ابْنُ عِيَاضٍ - عَنِ الأَعْمَشِ، عَنْ تَمِيمِ بْنِ سَلَمَةَ، عَنْ عُرْوَةَ، عَنْ عَائِشَةَ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم كَانَ يُخْرِجُ رَأْسَهُ مِنَ الْمَسْجِدِ وَهُوَ مُعْتَكِفٌ فَأَغْسِلُهُ وَأَنَا حَائِضٌ ‏.‏

sunnah.com