Hadith Q207
إِذِ الذِّكْرُ عَلَى طَهَارَةٍ أَفْضَلُ، لَا أَنَّهُ غَيْرُ جَائِزٍ أَنْ يُذْكَرَ اللَّهُ عَلَى غَيْرِ طُهْرٍ، إِذِ النَّبِيُّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ قَدْ كَانَ يَذْكُرُ اللَّهَ عَلَى كُلِّ أَحْيَانِهِ.
It was because mentioning Allah Almighty with purity is more virtuous, not because mentioning Allah Almighty without purity is not permissible. Because the Prophet Muhammad (peace be upon him) used to mention Allah Almighty at all times.
Hadith 207
Lady Aisha (may Allah be pleased with her) narrates that the Messenger of Allah (peace be upon him) used to remember Allah Almighty at all times. These are the words of Abu Kurayb’s narration.