Is table prefixing controlled by db_set_active()? If I use db_set_active() to fetch data from another database, how will that affect table prefixing?

Is table prefixing dynamic in the sense that it adjusts to the currently active database?
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)