If I were to cast a spell targeting an opponent while invisible or stealthed, would they be denied their Dexterity bonus? For example, if I cast Enervation while under the effect of Invisibility, would their Dex bonus be subtracted from their touch AC?
If you can't react to a blow, you can't use your Dexterity bonus to AC.
(Also see Combat Modifiers, which explicitly states an attacker's Invisibility denies dexterity to the defender)
This means that for spells which require a touch attack, such as Enervation, they would not be able to use their dexterity bonus unless they had detected you by other means.
Note that this only applies to Armor Class; it does not apply to spells which require a Reflex Save, such as Fireball.
Check the invisibility condition in the rule book. It specifically addresses this. It should be something like +2 to attack (assuming they don't have the blindsight or scent abilities) and there is no dex bonus.