sitemap.xml with spaces in line 1

I have a plugin that generates a Sitemap and creates a redirect for a multi-site installation. When the sitemap is created, it is stored in the upload directory of each blog: /wp-content/blogs.dir/1/sitemap.xml, but is available through /sitemap.xml

If you access the Sitemap from the actual location, it works as expected without adding an extra row. However, if you access it through the redirect, it adds an empty space to the first line of the sitemap, which causes an error.

I've looked into this problem in several support forums and they all pointed out that an extra line at the end of the functions.php (after?>) Theme could cause this problem. Alternatively, an extra line in wp-config.php, index.php or another plugin. I tested all these options without success.

A recommended solution was to use the Health Check plugin, which disables all plugins and changes the theme to the default. Then you can activate plugins individually to find the problem. This also offered no solution.

If all plugins are disabled and the default theme is installed, the sitemap redirect will still exist, and the extra row has been added.

So I started wondering if this was a core issue of WordPress and reinstalled all the core scripts, but to no avail.

I looked through the error logs and nothing.

Any consideration of where to go next to try to solve this problem would be greatly appreciated.

Many Thanks,
Beat