The Prophet (SAWA) did not pray to Allah to keep Ahlul Bayt (AS) away from Rijs, but he prayed to Allah to keep the Rijs away from Ahlul Bayt (AS).
This is a misunderstanding in the minds of many who do not realize the difference between (A'nhom) عنهم , and (Minhom) منهم or error in the translation.
A'anhom: means to drive the bad away not to be near them.
Minhom : means to drive the bad from them.
Allah (SWT) never said Minhom, but said A'nhom.
انما يريد الله ليذهب عنكم الرجس أهل البيت ويطهركم تطهيرا (33:33)
Ahlul Bayt (AS) are The Infallible Divine leaders who are completely purified by Allah (SWT) who stated in Quran that He wants to to keep the bad away from them because they have nothing from the bad at all.