וַיִּקְרָ֛א יְהוָ֥ה אֱלֹהִ֖ים אֶל־הָֽאָדָ֑ם וַיֹּ֥אמֶר ל֖וֹ אַיֶּֽכָּה׃
האָט גאָט דער האַר גערופֿן צו דעם מענטשן, און האָט צו אים געזאָגט: װוּ ביסטו?
Rashi
איכה WHERE ART THOU — He knew where he was, but He asked this in order to open up a conversation with him that he should not become confused in his reply, if He were to pronounce punishment against him all of a sudden. Similarly in the case of Cain, He said to him, (4:9) “where is Abel thy brother?” Similarly with Balaam, (Numbers 22:9) “what men are these with thee?” — to open up a conversation with them; so, also, in the case of Hezekiah with reference to the messengers of Merodach-baladan (Isaiah 39:3).
Radak
ויקרא..איכה, He called out “where are you?” G’d used these words as an opener for the conversation, not because He was unaware of their whereabouts. We find a repeat of this when G’d opened His conversation with Kayin (Genesis 4,9) or with Moses (Exodus 4,2).