If you face the error "Xap packaging failed. Object reference not set to an instance of an object." while trying to build your Windows Phone application, make sure you do not have any files added to your solution that no longer exist on disk.
In the image above, you can see the reference to banner.png is outdated and needs to be removed. Once you remove the reference, try rebuilding your app and it should build fine.