Whether an unmarried woman is "allowed" to cover her hair is not only dicussed in Halachic literature, but it is expressly discussed in the context of whether she is obligated.
The discussion, as you mentioned above in your question begins, with the the Rambam. He writes in (Issurei Biah 21:17)
יז לֹא יְהַלְּכוּ בְּנוֹת יִשְׂרָאֵל פְּרוּעֵי רֹאשׁ בַּשּׁוּק. אַחַת
פְּנוּיָה וְאַחַת אֵשֶׁת אִישׁ.
Jewish women should not walk in the marketplace with uncovered hair.
[This applies to] both unmarried and married women.
The Rambam rules that even an unmarried woman is obligated to cover her hair.
The Shulchan Arukh follows the Rambam's rulings regarding both matters – that the law that a woman's hair is a sexual incitement belongs to the laws of modesty and that the law regarding head covering applies even to an unmarried woman (Even Ha-Ezer 21:1-2).
The Beit Yosef (Orach Chayyim 75) writes that the basic law is in accordance with the Rambam
However, The Beit Shemuel (Even Ha-Ezer 21, no. 5) and the Chelkhat Mekokek (there, no. 2) interpret the Rambam and Shulchan Aruch differently and distinguish between "unmarried women" and "virgins."
In other words, when the Shulchan Arukh says in Even ha-Ezer that even unmarried women are obligated to cover their hair, he is referring to unmarried women who had once been married – that is, divorcees and widows.1 However, single women who have never been married are exempt from covering their hair.
The Magen Avraham (Orach Chayyim 75, no. 3) resolves the contradiction differently: The law of head covering applies only to a married woman, whereas the prohibition to walk about with "wild hair," which the Shulchan Arukh codifies in Even Ha-Ezer, relates to wild hair in its plain sense. In his view, the Sages decreed that a single woman must gather her hair together and not let it fall wild.
The accepted practice follows the Beit Shmuel and not the Magen Avraham. Thus, a single woman is not obligated to cover her hair, but a widow and a divorcee are obligated to do so (source)
For different reasons altogether, Rav Yitzchok Berkowitz ruled for a single woman; who was a teacher in a seminary teaching female students, that she is obligated to cover her hair.
His reasoning was that she is in a position of respect, and the underlying principle of hair covering and tznius in general (he did not provide a definitive source), is dignity and self respect, therefore she should cover her hair.