A difficult question, indeed. My first thought went to Genesis 3:19 and the simplicity of aligning the spirit returning to where it came from. And, while this may indeed be true, it doesn't exactly explain very much, nor stir the pot of curiosity. So, after further ponderance... maybe there's another way to approach this to see whether or not a few more layers of the onion can be peeled back.
Rather than heading straight into what "the spirit" is or might be, let's try giving some consideration to where (or what direction) it (whatever it is) might be "returning" to. In other words, where God is.
I think the best clue and indication we have for this is found in Isaiah 57:15.
For thus saith the high and lofty One that inhabiteth eternity, whose
name is Holy; I dwell in the high and holy place, with him also that
is of a contrite and humble spirit, to revive the spirit of the
humble, and to revive the heart of the contrite ones.
It actually appears there may be a bit of a conundrum in this verse, as it describes several distinct things that we don't (maybe can't) think of being together. Clearly "eternity" is not, and does not have, a certain or particular distance from anything (not even time itself.) Yet, "high and holy" does seem to indicate that it is a particular direction from us. Most intriguing, however, is the declaration that "the high and lofty One" (aka, God) dwells "with him also that is of a contrite and humble spirit..."
Hmmm... now that there is a rather clear possibility of spirit (at least, that of a "contrite and humble" sort) being with God, there appears to be a need to review and address what "the spirit" is or might be in Ecclesiastes 12:7. At the very least, I do not see that a contrite and humble spirit should be (nor can be) excluded from whatever is meant by "the spirit" in Ecclesiastes. In light of Isaiah 57:15 telling us that a contrite and humble spirit (while still live) is already with God (the explicit context of the verse being the habitation and dwelling place of God), it seems reasonable to suppose or conclude that there remains no other location or distance for spirit to "go to" when "the dust returns to the earth as it was."
While it might remain debatable whether or not (or how) a contrite and humble spirit (being descriptive of a living, breathing man) dwells with God in a "high and holy place" (which does not appear to be descriptive of a physical location of any sort), it surely must be realized that said spirit is not eternal (defined as being without beginning and without end), nor does it inhabit eternity.
Therefore, it seems reasonable to say and conclude that "returns to God" is the affirmation of the complete dissolution of life - רוּחַ ruach (spirit, breath, wind, etc.), however it (ruach) is described or by whatever definition is used for it.
John 3:8
The wind bloweth where it listeth, and thou hearest the sound thereof,
but canst not tell whence it cometh, and whither it goeth: so is every
one that is born of the Spirit.