When the Tanach describes an instance of prophecy, it is indicative of all prophecies in the same category. [II, 46] For example, a person may dream that he has traveled to a foreign land, married, settled down, and raised a family, though none of this actually happened. The same is true of prophetic allegories: the prophet may see himself doing things, over a long period of time, but they only occur in his prophetic vision. Some prophecies do not explicitly mention that the things described occur in visions but it’s well-established that this is how prophecy works, so it’s not necessary to mention it every time.
When a prophet says “God spoke to me…,” he need not spell out that it was in a dream, though the average reader may assume that the events and conversations described actually occurred. The Rambam therefore gives an example that is unmistakeable: in Ezekiel chapter 8, the prophet describes how he was sitting with the elders when he was lifted up and carried between Heaven and Earth to Jerusalem. There, he saw a hole in a wall. He excavated the hole and uncovered a door. He went through the door and saw what the people inside were doing, as described in the rest of the chapter. This was obviously a vision as Ezekiel was in Babylonia, not Jerusalem.
Just as all this clearly occurred in a vision, so did other prophecies that people might assume actually occurred. For example, when Ezekiel was told to lie on his side for more than a year (in Ezekiel chapter 4), this was in a vision. Similarly, when Isaiah appears to walk around naked and barefoot for three years (in Isaiah chapter 20), it occurred in a vision. God doesn’t actually make His prophets do degrading things that would subject them to ridicule.
Still another example is when Jeremiah girded his loins with a linen cloth, buried it in the rocks of the Euphrates, and later unearthed it, only to find that it had rotted (Jeremiah chapter 13). This was also in a vision; Jeremiah did not travel from Israel to Babylonia in order to bury a girdle by the Euphrates, and again to dig it up.
One more example: when Hoshea appear to marry a prostitute, have children with her, and give them specific names (Hosea chapter 1), it all occurred in a prophetic vision.
Once it is established that these things are prophetic allegories, it should be obvious to readers that they only occurred in the mind’s eye. The Rambam provides a number of other examples, stating that the fact that such things are allegories should now be self-evident to anyone who can differentiate reality from fantasy. When we are told that a prophet had a vision, everything he said and did subsequently is part of that vision, even if it is an extended account appearing to occur over the course of months or years.