Assuming you're not overriding logHook (or are doing it properly which sadly many do not), you can just import XMonad.Hooks.EWMHDesktops and apply the ewmh combinator to your config record.
If you're using the bad configuration that too many people point to as a "default" (the big one that overrides literally everything with defaults from a particular version) then there may not be any easy way to do it. That config was never a good idea, for all its popularity; it's a leftover from pre-0.5's hardcoded config.