Making them Indistinguishable
You don't specifically need the hostages to detect as evil undead - you could simply prevent the necromancers from being distinguishable from them.
Nondetection lasts an hour per level and protects against several spells, including "detect" spells. It also has a Communal variation. Note that Lesser Nondetection only lasts a minute per level, probably not long enough for the plan being described.
Alternatively, Undetectable Alignment could protect against alignment detection, while Appearance of Life could protect against Detect Undead. Although this involves more spells, they're lower level or affect more people, so they could be a cheaper alternative.
Whether polymorph effects like Alter Self would disguise undead is a little unclear. They cause you to lose extraordinary and supernatural abilities, but the "undead aura" that Detect Undead supposedly detects isn't listed in stat blocks. I think that makes it up to the GM. Personally, I'd say anything that changes your type makes you no longer detectable as undead.
Finally, the necromancers might be able to disguise themselves in clothing lined with lead, since a thin sheet of lead blocks "detect" spells. There's even a third-party resource for lead-lined materials (it doesn't specifically say in the description of the material that it blocks such spells - that's in the spell descriptions themselves). Of course, the downside of this approach is that your PCs might start wanting their own lead-lined clothing...
Making them look like Undead
Actually turning the people into something that detects as undead is difficult - most polymorph spells can only be cast on yourself or limit what you can turn people into. However, because there are spells that hide auras, you can use other effects to try and fool people.
Spells like Disfiguring Touch or Slough could give people the appearance of undead or monsters.
Polymorph has a couple of limitations. It can't technically turn people into undead, but there are humanoids like fetchlings and dhampirs that many people would probably mistake for undead. It also requires a willing subject. However, since the targets are already hostages, I think a threat of "accept the effects of this spell or I'll kill you" gets around that.