Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Just checked my copy and yes the villain (a dwarf called Zinixo) was trapped in a magic bubble by Rap - "I wrapped him up in an unbreakable soap bubble that stopped magic. He still had his power then, but he couldn't use it."
It is a while since I read them so I am not really sure. Having said that there are definitely dwarves in the story and being trapped in a magic bubble sounds familiar