Typically the "XML declaration allowed only at the start of the document" error is caused by white space preceding the <?xml tag.
Sometimes strange behavior, like outputting white space, may be caused by a plugin or theme conflict. If you are unfamiliar with checking for conflicts, we wrote a small guide that will walk you through the steps. You can find it here: How To Check For Plugin Conflicts