Lets start with the code you write and ignore the other licenses for a moment. You retain copyright of any code you write unless you expressly give that copyright up (sell it, doing work for hire, etc). You say that the organization has retained copyright for the compiled application. This is confusing. I don't see how you can have copyright of your code and they can have copyright of the compiled application as either:
- You could compile your code again and have an application they have copyright over, or
- You retain copyright of the code but can never build it as the org has copyright over the resulting executable
This sounds like a legal minefield, and its fairly clear you need to consult a lawyer if you want to leave it as it is but sort it out at a later date.
Since you are doing the work for free, I would recommend you sit down with the org and work out a license between the two of you that is acceptable for both parties. Which probably means that the org has no copyright claims to the application or source code, but express permission to use without fee the application (and possibly permission to use the source and modify it in the future without fee, but I guess no license to sell or distribute the source code). Other wise you could turn around in 6 months and say, any changes to the app will cost this much and I'm not giving you the source code. It is unclear whether the work you are doing is covered by a contract. This is where you would put such points.
So think about that very carefully, and protect your rights, but be professional and protect your client as well.
Now for the mixed licenses.
Public domain code you don't need to worry about.
Royalty free is a loaded term. It literally means you don't need to pay royalties for it. I assume the author means freely open source, with no requirement to pay royalties, advertise, include a copyright notice etc, but I can only amuse that, you have access to the actual license.
BSD licenses require that you include a copyright notice, you will be obliged to do this, but there is no requirement to provide source code or relinquish copyright.
Apache is like BSD, it requires copyright and disclaimer notices to be distributed with code/application but is permissive and doesn't require you to release source code etc.
Once again the MIT license is permissive requiring only that a statement be included with code and application.
If you write code using other peoples code with he mentioned licenses you will retain copyright of it and you will have no requirement to provide that code to any one else. you will be able to sell that code, or license that code as you see fit. you will however have to reprint the associated copyright disclaimers. None of these licenses will jeopardize your ownership.
However you still need to figure out how you license your application and or code to the organization you are dealing with. And the usual warning applies, consult a lawyer if any of this is important to you. They have the experience and knowledge to make better sense of this then us.