Is it part of the LDS religion to remove your hat during prayer? Or is that just part of western culture as a sign of respect? Are LDS required to remove their hats when they pray? Or can they pray with hats on?
Just to be sure, I have checked with every resource I am aware of, and there have been no formal declarations even associating the removal of a hat with prayer in LDS doctrine or theology.
From my personal experience, I do not believe this practice is limited to the Church o Jesus Christ of Latter-day Saints. As a youth in the Scouting organization in the US South, it was common for the MC or the one saying the prayer to preface prayers with saying, "A Scout is Reverent." At that cue, everyone would remove their cap and bow their head.
In the same vein, I know of no teaching regarding arms folded (a typical LDS custom), "prayer hands," or simply clasped hands within the Latter-day Saint faith. The intent of any method is simply to focus on the divine through prayer.
Latter-day Saints may pray with or without hats on, the greater concern is that whatever those praying do, they do it in reverence.
To quote Elder Bruce R. McConkie:
Prayers of the saints are expected to conform to a prescribed standard of divine excellence; they should fit into the approved pattern of proper prayer. They are to be addressed to the Father; should always be made in the name of Jesus Christ; must be reverential and worshipful in nature, which requirement includes use of the language of prayer (the pronouns thee and thine, for instance, never you and your); and above all they must be offered in sincerity of heart, with real intent and purpose, and must come from the lips of those who have broken hearts and contrite spirits; and finally, they should be closed with the word Amen. As a token of reverence and respect, when occasion permits, they should be made from a kneeling position.
(As an aside, the word "hat" is not to be found anywhere within Mormon Doctrine and only twice in Gospel Doctrine: Sermons and Writing of President Joseph F. Smith.)