How do I return the output from a callback function unthemed?
This is really easy: instead of returning the output in the page callback, just print it and exit.

Drupal 6

function foo_callback() {
  print theme('foo');
  exit();
}


One thing to keep in mind when doing this is that hook_exit() will not be invoked, as you'll be ending the script before Drupal reaches that point, so make sure you don't need it. If you do, you can invoke it yourself before calling exit():

function foo_callback() {
  print theme('foo');
  module_invoke_all('exit');
  exit();
}


Drupal 7

drupal_exit() was added for this use-case, and will call all the shutdown stuff before exiting. So you just need:

function foo_callback() {
  print theme('foo');
  drupal_exit();
}