Rakshasa have Limited Spell Immunity and can only be affected by spells of 6th level and lower if they want to be affected. Let's say I'm fighting a Rakshasa who is under the effects of a Haste spell. If I want to dispel the haste spell, presumably I cannot target the Rakshasa with Dispel Magic, but can I target the Haste effect?
In order to end the haste spell you would have to target the rakshasa.
From the description of dispel magic:
Choose one creature, object, or magical effect within range. Any spell of 3rd level or lower on the target ends.
The haste spell isn't creating a magical effect in the space (that is things like illusions, walls of fire, etc.). If you would like to argue otherwise you are very quickly into the realm of things 5e doesn't define properly (ie. what is an object, magical effect, etc.?).
Do note that you can end it by casting dispel magic using a 7th level spell slot (or higher) which would automatically end all spells of 7th level or lower on it.