Sayyiduna Abu Qatadah bin Rabi’i (may Allah be pleased with him) narrates that the Messenger of Allah (peace be upon him) used to seat the daughter of Sayyiduna Abu Al-As (may Allah be pleased with him) (i.e., his granddaughter) on his neck during prayer. Then when he (peace be upon him) would go into prostration, he would put her down (on the ground), and when he (peace be upon him) would stand up, he would pick her up again.
For in the carrying by the Prophet, peace and blessings be upon him, [بِنْتَزَيْنَبَرَضِيَاللَّهُعَنْهَا], there is an indication that if her clothes were such that prayer would not be valid in them, he would not have carried her, for there is no difference between wearing an impure garment and carrying it during prayer.
Hadith Referenceصحيح ابن خزيمه / جماع أبواب اللباس فى الصلاة / 783