There's a couple of ways (as usual) to get this done. The easiest (in my opinion) is to use a custom resolver (see google results) and look inside the list of
ResolvedItems - this list will contain all the items that have been resolved to be (un)published and you can manipulate the contents of the list to add or remove items from it.
Another option is to use the same
ResolveEngine instruction that Tridion does when deciding to (un)publish something and see what's returned - something along these lines:
Component c = (Component)session.GetObject("tcm:5-7101");
ResolveInstruction i = new ResolveInstruction(session)
Purpose = ResolvePurpose.UnPublish
Publication p = (Publication)c.ContextRepository;
PublicationTarget pt = (PublicationTarget)session.GetObject("tcm:0-2-65537");
PublishContext context = new PublishContext(p, pt );
Tridion.Collections.ISet<ResolvedItem> items = ResolveEngine.ResolveItem(c, i, context);
foreach (var item in items)
// do something
// throw some exception or whatever...