You shall not pass.
Halt Undead would provide you a few rounds, holding up to three targets in their positions. You should definitely consider buying a scroll or two.
Look at me, I am the master now!
Even though some of the creatures are immune to mind affecting spells there is usually another way to take control over them, so you can still keep your role in the party, as a controller. Even at your current level the undead creatures could be easily enthralled with the Control Undead.
Dealing with other types.
There are other equivalents of such spells for Constructs, Oozes, and Vermin, who have the same immunity, however some of these exist only as class' special abilities, feats and magic items. For example, to control constructs you could use a Rod of Construct Control, but there is no spell providing such effect. Part of them may be still inaccessible for you, until you will be able to use 6-th level scrolls.
There are 2 ways to resolve this that have been discussed by WOTC designers in an official capacity: An older option on a Sage Advice segment of one of their Dragon Talk podcasts from January 2017 (specifically at about 13:12 for ~7.5 minutes), and a newer optional rule provided by Xanathar's Guide to Everything's Dungeon Master's Tools chapter.
Sage Advice: Intent is that spell effect doesn't happen, action cost applies, and DM judges whether spell slot is used
To summarize Jeremy Crawford's statements in the January 2017 podcast, "illegal targeting" is a gap in the written rules (as of the date of the podcast) and it's mostly open to DMs to choose how to handle it. That said, Crawford says the intent for how it should be handled is that the spell should still take up the casting time but the spell effect will not occur and not consume a spell slot (I.E., option 2 listed in the question).
There are enough corner cases with this solution at the time of the podcast that Crawford still recommends that a DM adjudicate each individual occurrence on a case-by-case basis until there is eventually an official printed rule. As an example of why, he says spells such as those which require a spell attack probably should still consume their spell slot since there'd be some dissonance with the fact that those spells can miss, unlike saving throw spells which always "hit" but the target can resist their effects.
(He does not clarify what should happen if something like Eldritch Blast, which targets only creatures, actually hits a non-creature in this case.)
The flavor reason for this is that he views spells as essentially trying to make a magical connection between the caster and target. When that connection is established, the energy of the spell is consumed in producing the spell's effect - but if the target isn't one the spell can make a connection to, nothing happens and that energy isn't expended.
He views spell attack spells as a different category; if I had to guess why, it's likely because they mainly produce some effect that then follows standard attack rules in trying to reach the target.
Xanathar's Guide to Everything (optional): No spell effect, action cost applies, and spell slot is expended
As of Xanathar's Guide to Everything's release in November 2017, the (optional) rule for resolving invalid spell targets states (p. 85-86):
If you cast a spell on someone or something that can’t be affected by the spell, nothing happens to that target, but if you used a spell slot to cast the spell, the slot is still expended. If the spell normally has no effect on a target that succeeds on a saving throw, the invalid target appears to have succeeded on its saving throw, even though it didn’t attempt one (giving no hint that the creature is in fact an invalid target). Otherwise, you perceive that the spell did nothing to the target.
This is in slight contrast to Crawford's earlier statements on the topic above, in that the spell still occurs and consumes a spell slot with no apparent effect.
Best Answer
"Your colour spray lights up the crypt for a moment. You've caught the horror cleanly in its fan… but it continues to advance as if the spray of blinding light didn't exist."
Players are there to experience a world and events, with their characters in the middle of it, solving problems by their wits and kicking tail with their characters' abilities. Describing that world in a way that they can engage with it directly, instead of abstractly via the rules, is vital for many groups to maintaining the roleplaying part of "roleplaying game". The suggested narration above, or something like it, helps your players stay in the head-space of your imaginary world. Players should not be told why something unusual happened, by default—there's not much fantasy and wonder in exploring a fantasy world if everything fantastic is explained right away!
The player will already be puzzling at the discrepancy: "Why didn't that work? Is it resistant to other spells? There's no light in this crypt… does it not need its eyes to see? The chance of it being undead is pretty good if so…" For most people, this is fun! Don't interfere with that fun by immediately handing players the answer to every unknown they run into.
Of course, there are things that won't be unknown to the characters, things that naturally call for giving the players more information.
If the character does have special knowledge, such as Knowledge: Religion (which covers undead's abilities and weaknesses) or Knowledge: [local area] (which might give relevant rumours of the creature's behaviour), then ask for a check and follow up a success with the sort of information that would give them: "The colour spray failed to affect it, and you know that undead are immune to spells that confuse the mind…" or "You remember a story once about a young man who'd disturbed its lair being followed by the creature through a blinding, deafening storm as if the weather wasn't there."
The only time you should just tell (instead of show) your players why something is happening with no justification in the game world (like Knowledge skills, or reminding them of the last time they encountered a similar creature) is if it would directly interfere with what your group thinks is fun about the game.
Some groups play for the tactics and the efficient combat-plays. Further, some of those groups won't be interested in puzzling out the nature of fantastic things through the clues in your narration. If you're playing in this kind of group, by all means lay as much information on the table as you've got and move on with the fun parts of the game.