A prayer closet is any private place where you can connect with God without distractions. Intimacy with God matters more than location when we pray.
The main teaching we have on a “prayer closet” in Scripture is Matthew 6, in which Jesus contrasts those who pray in public to gain others’ admiration with instructions for His disciples to pray in the inner-most area of their homes, as far away from the public as possible. The word "room" is the Greek tameion meaning an inner storage chamber or secret room. Jesus was communicating that prayer is about God, not about the watching world. The prophet Daniel came before the time of Jesus, but it is clear from Daniel 6:10-12, that there was a particular place he would go to pray, although this area was not as concealed as the one Jesus describes in Matthew 6:5–6. At its core, Jesus’ teaching is about being sincere in prayer, praying from the heart, a point covered in both the Old and New Testament (Isaiah 29:13; Hosea 7:14; James 5:16; Hebrews 10:22).
Jesus' instruction in Matthew 6:1-6 is less about where you pray and more about not drawing attention to our piety or self-righteousness when we pray. Prayer, giving, and serving are all responses to God's goodness to us, rather than ways to show others our own goodness. The concept of a "prayer closet" is simply to remember that prayer is about fellowship with God. A "prayer closet" can be anywhere we can have uninterrupted intimacy with God. With that being said, some Christians take Jesus' admonition literally and set aside a room, or even a closet, dedicated to prayer—which can certainly be a beneficial practice. However, most Christians who follow Jesus’ instruction simply identify a specific, quiet place in which to pray regularly. Many also use their "prayer closet" for Bible study, which makes sense as God speaks to us through His Word, and studying the Bible goes hand-in-hand with praying. Overall, Jesus' instruction is less about where we pray and more about the mistake of drawing attention to our piety or self-righteousness as we pray. He preaches about praying, giving, and serving as a response to God's goodness to us, rather than a way to show others our own goodness.