What is the purpose of url('', array('prefix' => &$prefix)) in drupal_add_js()?
Modules can implement hook_url_outbound_alter() to change to change generated URL's. The most typical example of that are language prefixes.

If you have two languages enabled with path prefixes, english at /en and german at /de, then pathPrefix will either be /de or /en. Since there is no actual API to get that prefix, it uses that trick.

The hook invokes locale_url_outbound_alter(), which in turn invokes the defined url_rewrite callbacks of the enabled language negotation types. In case of the path prefix, that is locale_language_url_rewrite_url which changes the prefix at the end of the function.

The reason for doing this is that it allows ajax calls and other javascript requests (for example the admin overlay) to do that request in the current language, so that strings returned by those requests are in the expected language.