Deus Ex Machina
He simply can. You as the GM can make up anything you want if it helps advance your plot. If you want him to be able to block teleportation, then he can. Perhaps the chamber he is in permanently blocks teleportation in and out due to some ancient lost magic cast on it centuries ago. You let your imagination run wild here.
3.5 RAW Spell
The only spell I could find that would allow your NPC to do this on his own is a lvl 4 spell called Dimensional Anchor. Any other spells were either too high for his level, or weren't for a wizard.
Dimensional Anchor: This seems the better option for a more ranged encounter. It will allow you to lock the party in at longer range than Anti-Teleport Sphere, but you do need to hit them with it and you need to hit each party member, one per cast. You also have to overcome SR. It lasts minutes per level, which should be enough for any encounter, certainly enough to get them in range of Anti-Teleport Sphere. The big downside to this though is the number of rounds you need to spend to lock the entire party down, 1 per party member, although in theory you just need to lock down their casters, as without the casters no one is teleporting away.
I did find a couple of homebrew spells called Anti-Teleport Sphere and Null Teleport Zone. You may be open to hombrew content, and if you are these spells doe exactly what you need.
Anti-Teleport Sphere: From reading it seems more like a defensive spell to stop people dropping in on the wizard, but there's no reason why he couldn't cast it to stop them escaping. It does have a limited area of effect though. At lvl 14 it'll only affect 140' radius, or 280' diameter sphere, so you need to keep them close. But with it lasting a day for 5 minutes prep, it seems like a spell I would cast in his place. It offers the party no saves either.
Null Teleport Zone: I takes a day to cast for the area you need, but as you have the time to prepare that isn't an issue. It prevents all types of teleportation. It appears to be the wizards version of Forbiddance.
It is reasonable to expect such a powerful boss to have minions capable of casting spells for you. I've previously mentioned Forbiddance, and having a cleric minion cast that for the boss isn't infeasible. Forbiddance would permanently stop the players from teleporting in or out of the area. Although as @Zachiel has pointed out when commenting to @BrianBallsun-Stanton, who also mentioned this option, the spell specifically states:
Forbiddance seals an area against all planar travel into or within it. This includes all teleportation spells (such as dimension door and teleport), plane shifting, astral travel, ethereal travel, and all summoning spells. Such effects simply fail automatically.
It doesn't mention anything against teleporting out, so is open to interpretation. Personally I interprate that to mean you cannot cast teleport whilst in the area.