Act-utilitarianism has a lot of problems with mapping well onto our innate moral sense. This is hardly the only example. There are oodles of other examples, such as when it is okay to eat all the cake at a birthday party. (Hint: it is not okay to eat it all yourself even if, in the absence of social responses, it would increase your happiness more than everyone else's combined.) With many of these, you end up tempted to then start lying and hiding your behavior as then "nobody is hurt", except the reaction to discovery of lying and hiding is even worse, and you end up with a cascading mess.
Unfortunately, this mismatch is so bad that the act-utilitarian would probably end up deciding that nobody should strictly follow act-utilitarianism, even themselves.
So I think the meta-answer (neglecting concerns about disease, desire to kill or at least not prevent the deaths of sexually desirable people, etc.) is that to some extent you simply must acknowledge that people have a powerful innate moral sense and you have to work with it.
That is, it is immoral (as a utilitarian) to do things that disgust and horrify people, even if that reaction is moral in character, and even if they only know in the abstract that such things happen, not about individual instances. At least given present societal norms, Necrophilia would be in that category.
Note that this is also true, as a utilitarian, for e.g. gay marriage or sex out of wedlock. You might envision a society where it is accepted, but your calculation could well be that it's immoral solely by virtue of (some) people's distaste for it, or that you must fix the distaste first.