Can Gandalf really appear out of nowhere in Tolkiens Books?
During The Hobbit, Gandalf vanished without a trace right before the encounter with the trolls; nobody from Thorin's companions noticed this until they thought about asking him for help. Later he was able to follow the orcs who had captured Thorin's company down the tunnels of Goblin-town. Finally, moments before the Battle of Five Armies:
Suddenly without a signal they sprang silently forward to attack. Bows twanged and arrows whistled; battle was about to be joined. Still more suddenly a darkness came on with dreadful swiftness! A black cloud hurried over the sky. Winter thunder on a wild wind rolled roaring up and rumbled in the Mountain, and lightning lit its peak. And beneath the thunder another blackness could be seen whirling forward; but it did not come with the wind, it came from the North, like a vast cloud of birds, so dense that no light could be seen between their wings.
"Halt!" cried Gandalf, who appeared suddenly, and stood alone, with arms uplifted, between the advancing dwarves and the ranks awaiting them. "Halt!" he called in a voice like thunder, and his staff blazed forth with a flash like the lightning. "Dread has come upon you all! Alas! it has come more swiftly than I guessed. The Goblins are upon you! Bolg of the North is coming. O Dain! whose father you slew in Moria. Behold! the bats are above his army like a sea of locusts. They ride upon wolves and Wargs are in their train!" Amazement and confusion fell upon them all. Even as Gandalf had been speaking the darkness grew. The dwarves halted and gazed at the sky. The elves cried out with many voices."
This was presumably accomplished by a combination of stealth and some illusion magic (how else can one explain that whole armies advancing on each other didn't notice an old grey man before them?).
Gandalf-as-Olorin is a Maia; he certainly doesn't need trinkets such as rings (or even Rings) to be invisible:
Moreover their shape comes of their knowledge of the visible World, rather than of the World itself; and they need it not, save only as we use raiment, and yet we may be naked and suffer no loss of our being. Therefore the Valar may walk, if they will, unclad, and then even the Eldar cannot clearly perceive them, though they be present.
Sourced from the Ainulindale, and although it specifically refers to the Valar, we may assume that the same capability is present in the Maiar - we see one similar example in Chapter 11:
Too bright were the eyes of Arien for even the Eldar to look on, and leaving Valinor she forsook the form and raiment which like the Valar she had worn there...
What about Olorin-as-Gandalf? Again in the Silmarillion, this time in the Valaquenta, we read the following:
for though he loved the Elves, he walked among them unseen, or in form as one of them, and they did not know whence came the fair visions or the promptings of wisdom that he put into their hearts. In later days he was the friend of all the Children of Iluvatar, and took pity on their sorrows; and those who listened to him awoke from despair and put away the imaginations of darkness.
So it seems that invisibility is most definitely something he's capable of, even when constrained in his form as Gandalf.
As dianod says, Gandalf doesn't do this anywhere in the books. It's an interesting question though whether he would be able to. We know that at least one Ring of Power - the One Ring - does have the ability to grant invisibility, at least to Hobbits. So the questions are, would the Ring that Gandalf carries, Narya, be capable of granting that power too: and, could it grant that to Gandalf or is invisibility something specific to Hobbits?
For the second question, we have the counter-example of Isildur, who was invisible until the Ring slipped off his finger after the Pelennor Fields. I've previously speculated that invisibility comes naturally to Hobbits as an extension of their natural stealth, but it's clearly not exclusive to them and we can imagine that someone as powerful as Gandalf would be able to access that power, if possible.
Which brings us back to the first question. Is Narya capable of bestowing invisibility? We don't know explicitly. It is described as having the power to inspire others to resist tyranny, but nothing about overt powers. But on the other hand, it does seem likely that invisibility was a standard power of Great Rings: Gandalf was able to identify Bilbo's ring as one simply on the basis of that, even before he knew it was the One.
So, in summary, I think Gandalf Ring would have given him the power to turn invisible, if he had wanted.