This prayer is mentioned in Shrimad Bhagavata Purana 6.4.23 to 6.4.34, it was offered by Prajapati Daksha to Lord Vishnu.
In the beginning, Daksha created all the demigods, demons and human beings, but when he found the population not increasing properly, he took sannyasa and went to Vindhya Mountain, where be underwent severe austerities and offered Lord Vishnu a particular prayer known as Hamsa guhya (हंसगुह्य), by which Lord Vishnu became very pleased with him.
Hamsa-guhya (हंसगुह्य) :
नम: परायावितथानुभूतये गुणत्रयाभासनिमित्तबन्धवे ।
अदृष्टधाम्ने गुणतत्त्वबुद्धिभि-र्निवृत्तमानाय दधे स्वयम्भुवे ॥ २३
Prajapati Daksa said: Supreme you are not bund by the illusory energy and the physical categories you produces. He possesses the potency for unfailing knowledge and supreme willpower, and He is the controller of the living entities and the illusory energy. The conditioned souls who have accepted this material manifestation as everything cannot see Him, for He is above the evidence of experimental knowledge. Self-evident and self-sufficient, He is not caused by any superior cause. Let me offer my respectful obeisances unto Him.
न यस्य सख्यं पुरुषोऽवैति सख्यु: सखा वसन् संवसत: पुरेऽस्मिन् ।
गुणो यथा गुणिनो व्यक्तदृष्टे-स्तस्मै महेशाय नमस्करोमि ॥ २४ ॥
As the sense objects cannot understand how the senses perceive them, so the conditioned soul, although residing in his body along with the Supersoul, cannot understand how the supreme spiritual person, the master of the material creation, directs his senses. Let me offer my respectful obeisances unto that Supreme Person, who is the supreme controller.
देहोऽसवोऽक्षा मनवो भूतमात्रा-मात्मानमन्यं च विदु: परं यत् ।
सर्वं पुमान् वेद गुणांश्च तज्ज्ञोन वेद सर्वज्ञमनन्तमीडे ॥ २५ ॥
Because they are only matter, the body, the life airs, the external and internal senses, the five gross elements and the subtle sense objects cannot know their own nature, the nature of the other senses or the nature of their controllers. But the living being, because of his spiritual nature, can know his body, the life airs, the senses, the elements and the sense objects, and he can also know the three qualities that form their roots. Nevertheless, although the living being is completely aware of them, he is unable to see the Supreme Being, who is omniscient and unlimited. I therefore offer my respectful obeisances unto Him.
यदोपरामो मनसो नामरूप-रूपस्य दृष्टस्मृतिसम्प्रमोषात् ।
य ईयते केवलया स्वसंस्थया हंसाय तस्मै शुचिसद्मने नम: ॥ २६ ॥
When one’s consciousness is completely purified of the contamination of material existence, gross and subtle, without being agitated as in the working and dreaming states, and when the mind is not dissolved as in suṣupti, deep sleep, one comes to the platform of trance. Then one’s material vision and the memories of the mind, which manifests names and forms, are vanquished. Only in such a trance is the Supreme Personality of Godhead revealed. Thus let us offer our respectful obeisances unto the Supreme Personality of Godhead, who is seen in that uncontaminated, transcendental state.
मनीषिणोऽन्तर्हृदि सन्निवेशितं स्वशक्तिभिर्नवभिश्च त्रिवृद्भि: ।
वह्निं यथा दारुणि पाञ्चदश्यं मनीषया निष्कर्षन्ति गूढम् ॥ २७ ॥
स वै ममाशेषविशेषमाया निषेधनिर्वाणसुखानुभूति: ।
स सर्वनामा स च विश्वरूप: प्रसीदतामनिरुक्तात्मशक्ति: ॥ २८ ॥
Just as ritualistic brahmaṇas can extract the fire dormant within wooden fuel by chanting the fifteen Sāmidhenī mantras, similarly the learned can know you who is hidden in twenty seven elements, who by His own spiritual potency is situated within the heart.
These twenty-seven elements constitute the external energy of the Lord. Great yogīs meditate upon the Lord, who is situated as the Supersoul, Paramātmā, within the core of the heart. May that Supersoul be pleased with me.
The Supersoul is realized when one is eager for liberation from the unlimited varieties of material life. One actually attains such liberation when he engages in the transcendental loving service of the Lord and realizes the Lord because of his attitude of service. The Lord may be addressed by various spiritual names, which are inconceivable to the material senses. When will that Supreme Personality of Godhead be pleased with me?
यद्यन्निरुक्तं वचसा निरूपितं धियाक्षभिर्वा मनसोत यस्य ।
मा भूत्स्वरूपं गुणरूपं हि तत्तत् स वै गुणापायविसर्गलक्षण: ॥ २९ ॥
Anything expressed by material vibrations, anything ascertained by material intelligence and anything experienced by the material senses or concocted within the material mind is but an effect of the modes of material nature and therefore has nothing to do with the real nature of the Supreme Personality of Godhead. The Supreme Lord is beyond the creation of this material world, for He is the source of the material qualities and creation. As the cause of all causes, He exists before the creation and after the creation. I wish to offer my respectful obeisances unto Him.
यस्मिन्यतो येन च यस्य यस्मै यद्यो यथा कुरुते कार्यते च ।
परावरेषां परमं प्राक् प्रसिद्धं तद् ब्रह्म तद्धेतुरनन्यदेकम् ॥ ३० ॥
The Supreme Brahman, Kṛṣṇa, is the ultimate resting place and source of everything. Everything is done by Him, everything belongs to Him, and everything is offered to Him. He is the ultimate objective, and whether acting or causing others to act, He is the ultimate doer. There are many causes, high and low, but since He is the cause of all causes, He is well known as the Supreme Brahman who existed before all activities. He is one without a second and has no other cause. I therefore offer my respects unto Him.
यच्छक्तयो वदतां वादिनां वै विवादसंवादभुवो भवन्ति ।
कुर्वन्ति चैषां मुहुरात्ममोहं तस्मै नमोऽनन्तगुणाय भूम्ने ॥ ३१
Let me offer my respectful obeisances unto the all-pervading Supreme Personality of Godhead, who possesses unlimited transcendental qualities. Acting from within the cores of the hearts of all philosophers, who propagate various views, He causes them to forget their own souls while sometimes agreeing and sometimes disagreeing among themselves. Thus He creates within this material world a situation in which they are unable to come to a conclusion. I offer my obeisances unto Him
अस्तीति नास्तीति च वस्तुनिष्ठयो-रेकस्थयोर्भिन्नविरुद्धधर्मणो: ।
अवेक्षितं किञ्चन योगसाङ्ख्ययो: समं परं ह्यनुकूलं बृहत्तत् ॥ ३२ ॥
There are two parties — namely, the theists and the atheists. The theist, who accepts the Supersoul, finds the spiritual cause through mystic yoga. The Sāṅkhyite, however, who merely analyzes the material elements, comes to a conclusion of impersonalism and does not accept a supreme cause — whether Bhagavān, Paramātmā or even Brahman. Instead, he is preoccupied with the superfluous, external activities of material nature. Ultimately, however, both parties demonstrate the Absolute Truth because although they offer opposing statements, their object is the same ultimate cause. They are both approaching the same Supreme Brahman, to whom I offer my respectful obeisances.
योऽनुग्रहार्थं भजतां पादमूल-मनामरूपो भगवाननन्त: ।
नामानि रूपाणि च जन्मकर्मभि-र्भेजे स मह्यं परम: प्रसीदतु ॥ ३३ ॥
The Supreme Personality of Godhead, who is inconceivably opulent, who is devoid of all material names, forms and pastimes, and who is all-pervading, is especially merciful to the devotees who worship His lotus feet. Thus He exhibits transcendental forms and names with His different pastimes. May that Supreme Personality of Godhead, whose form is eternal and full of knowledge and bliss, be merciful to me
य: प्राकृतैर्ज्ञानपथैर्जनानां यथाशयं देहगतो विभाति ।
यथानिल: पार्थिवमाश्रितो गुणं स ईश्वरो मे कुरुतां मनोरथम् ॥ ३४ ॥
As the air carries various characteristics of the physical elements, like the aroma of a flower or colors resulting from a mixture of dust in the air, the Lord appears through lower systems of worship according to one’s desires, although He appears as the demigods and not in His original form. What is the use of these other forms? May the original Supreme Personality of Godhead please fulfill my desires.