We know this is a symbolic event because the Supreme Being, knowing everything, would not need to ask Adam where he was. The reason for this question is to clarify to the audience the symbolism involved in not being in God's presence, and the symbolic concept of nakedness.
As we've clarified in earlier verses, this is an allegorical story, but it is a true event. We might compare this with how parents would tell a child how a baby is conceived. They wouldn't get into all the technical details. They would compare it to something the child has seen and could connect with.
In the same way, this allegorical story of Genesis describes symbolically how each of us fell from the spiritual world to the physical world.
Remember, Adam symbolizes each of us. Eve symbolizes the community of the spiritual world. The serpent symbolizes our potential to desire to be like God. The fruit represents self-centeredness. The tree of life represents love for God. The tree of knowledge of pleasure and pain (correct translation - not 'good and evil') represents our freedom to not love God - after all, love requires freedom.
At this stage in the story, after the symbolic Adam (each of us) has eaten the fruit that God asked us not to eat, Adam felt naked. Adam was also not in God's presence - which caused God to ask Adam where he was.
The texts of the Old Testament use the concept of being out of the presence of God multiple times. To be out of God's presence does not mean that God cannot see us, or that God is away from us. It means that our consciousness is away from God. It means that we are no longer linked up with God. We no longer care about Him. We no longer want to be with Him.
This is the product of self-centeredness. The pure citizens of the spiritual realm are not self-centered. They are God-centered. Their lives revolve around pleasing the Supreme Being, and loving Him within their natural relationships with Him. But because love requires freedom, each of us has the choice to be focused on pleasing God or focused upon pleasing ourselves.
Those of us who have left the spiritual realm and living in temporary physical bodies in the physical world are here because we decided to become self-centered rather than God-centered. When we made that choice, we left the presence of God in that we became focused on ourselves rather than Him. This is the symbolic meaning of God calling out, "Where are you?"
Notice that being out of God's presence in this story coincides with Adam's realization that he is naked. As described with an earlier verse, nakedness represents purity in Genesis. To realize one is naked represents a change in consciousness - from one of being pure to one of not being pure.
We can understand the use of this sort of symbolism because young toddlers will often walk around naked without being self-conscious for some time, and then suddenly realize they are naked at some point. The baby realizes its nakedness, and suddenly becomes ashamed by it. Prior to this, the baby's consciousness was seemingly purer - as the baby was not so self-conscious. While this event does not fully describe what is taking place for Adam, it provides something we can relate to. Most of us can relate with a baby suddenly becoming self-conscious and realizing their nakedness.
In this case, Adam's realization he is naked represents our change of consciousness from being pure (lovingly God-centered) to becoming self-centered. It represents the dynamic involved in our fall from the spiritual realm.
At one point, we were each pure in the spiritual realm. Our consciousness was focused upon pleasing and loving the Supreme Being, and we enjoyed a unique relationship with God. This is represented in this story by the fact that God was walking through Eden looking for Adam. God wants to exchange this loving relationship with us, but we have fallen into a state of self-centeredness - becoming envious of God.
Once we fell into the desire to enjoy as God enjoys, we became self-centered and envious of God. This took away our purity. This made us feel ashamed, and we began to hide from our pure selves with a new consciousness - one full of desire and envy. This is symbolized by Adam hiding from God.
The reason why God asks, "who told you that you were naked?" is because He knows that self-centered behavior is connected to the desire for self-enjoyment. It is not as though He doesn't know what happened. The story is connecting the dots for the audience.
Self-enjoyment is not our nature. It is God's nature. The reason why even the richest, most famous people - who get whatever sensual thing they want including sex - are empty and unsatisfied is because enjoyment is not our true nature. We were created by God to give Him enjoyment. We are God's loving servitors, and God is the Enjoyer.
This is also why even the wealthiest persons, after years of being wealthy and trying everything - end up feeling the most enjoyment in caring for their family, society, and often caring for others who are less fortunate. They are feeling more joy in caring for others than in serving themselves. Even with all that fame and wealth.
This is the clear proof that our natural position is are not being the enjoyer. We are caregivers by nature. And while serving others and caring for others gives us joy, our most extreme joy comes from caring for and serving the Supreme Being.
And yes, while God 'commanded' the symbolic Adam not to eat from the tree of self-centeredness, God did put that symbolic tree there, in the 'middle' (Gen. 3:3) of the Garden no less. And God did certainly put the tree there, and even permitted Adam to eat its symbolic fruit.
So why did God put the symbolic tree in the middle of Eden and allow Adam to get to its fruit if He didn't want Adam to eat that fruit? Did God lose control over the situation?
God never loses control. This is why He is God. God is the Supreme Being, and He created all things, and controls all things.
However, God also wants to exchange love with those He created. In order to exchange real love, there must be freedom. If we were forced to love God that would not be love. That would be slavery.
God granted each of us the freedom to love Him or not. He asked us not to become self-centered, as that would certainly mean the end of our loving relationship with Him, but certainly He allowed us to become self-centered if we desired so.