Suppose there’s a perfect God. If so, then he wouldn’t create any subpar worlds. For example, if there’s a world in which all creatures endure nothing but undeserved horrible suffering, then God wouldn’t create that world. But, since God exists in ALL possible worlds, it would be impossible for there to be a possible world such as I described because God would also exist and God’s existence would be incompatible with that world.
There clearly are sub-par possible worlds, or worlds which contain "gratuitous evil" (there's nothing incoherent about the concept). So I take this to show that God does not exist in all possible worlds.
Justin adds in comments:
This might get to the distinction between logical possibility and metaphysical possibility that I’ve heard folks in PR talk about (doesn’t Plantinga make the distinction?). It’s not logically impossible for gratuitous evil to exist, but it’s metaphysically impossible. Anybody else know much about how this distinction’s supposed to work? Would that solve the problem?
The distinction is explained in my post Misusing Kripke; Misdescribing Worlds. The present case would be a clear misapplication of the Kripkean semantic distinction, since we would require a different space of worlds, and not merely a different way of describing them. (See linked post for full explanation.)
But perhaps we could employ the more radical distinction that I've previously raised, i.e. the distinction between possible worlds generally (a content-based specification requiring mere coherence), and those that really could have been actualized (an irreducibly modal property).
[This may be what other philosophers have in mind with the conceptual/metaphysical possibility distinction. But that one is too often defended by a misguided appeal to Kripke/Putnam cases that merely support a semantic distinction. I will use a different terminology in order to clarify the difference, and distance myself from such misguided defences.]
A theist might think that there is an important sense in which God couldn't have failed to exist. But his non-existence isn't logically incoherent, so there is a "possible world" (in the standard sense of the term) representing this state of affairs. Now, if the only way for a possible world to be actualized is through God's acts of Creation,* then these possible worlds are ones that couldn't (really) possibly be actualized. (I assume the theist holds that God cannot cease to exist, and so cannot create a world in which He doesn't exist.) So it may be misleading to call them "possible worlds". However, that seems the standard practice of contemporary philosophers. So long as we keep clear on the different kinds of possibility we're talking about here, it hopefully won't cause too many problems.
Armed with my distinction, then, a theist can allow that a Godless world containing gratuitous evil is a coherent possibility, one that cannot be ruled out a priori even on ideal reflection and when described in semantically neutral terms (which rules out Kripkean a posteriori necessities). Nevertheless, they might hold God's existence to be what Chalmers calls a "strong necessity" (see sections 7-10 of the linked paper. Note that Chalmers argues against such a view).
* = [But why think that the only way for a possible world to be actualized is through God's acts of Creation? Perhaps a world could obtain through brute fact, as many atheists (myself tentatively included) believe is actually the case. It may be difficult to see why a world might obtain. But we could just as well ask: why not?]