Is table prefixing controlled by db_set_active()?
When you use db_set_active you change the config that Drupal uses, so in theory you could use db_set_active to use the same database but change the prefix used.

Drupal will use the configuration defined, and the changed they imply.

You should note, that db_set_active won't work if you use multiple db backends for older Drupal versions (Drupal 6 and earlier, several MySQL backends are fine, but you can't switch from PgSQL to MySQL)