All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
First of all, we would like to give you a very important principle in the Sharee'ah. Such principle will undoubtedly help you take the appropriate stand on many matters: ‘It is prohibited to help in any manner in committing a forbidden act.’ Allaah Says (what means): {And cooperate in righteousness and piety, but do not cooperate in sin and aggression. And fear Allaah; indeed, Allaah is severe in penalty.} [Quran 5:2]
Allaah also Says (what means): {And do not incline toward those who do wrong lest you be touched by the Fire, and you would not have other than Allaah any protectors; then you would not be helped.} [Quran 11:113] Also, the Prophet said: “Some emirs (rulers) will come and will bring nearest to them the worst people. They will also delay the prayers from their fixed times. Anyone who happens to be in that time should avoid working as a monitor (that gives reports to the ruler about his subjects), a policeman, a tax collector or a treasurer.” [Ibn Hibbaan, and Al-Albaani graded it as Hassan].
From the above, you can deduce that it is unlawful to work in writing or calculating Riba (interest and/or usury) in any of the fields you mentioned or any other fields. This answers your first and third question.
As for your second question, know that the ruling on collecting taxes from Muslims differs according to one of the two following situations:
First, when these taxes are collected in a Muslim country, they can either be lawful or unlawful. They are lawful, when the country imposes taxes on the citizens in order to provide them with the appropriate facilities and infrastructure like schools, hospitals, tarred roads, etc…, provided the state cannot provide those facilities from its own revenues and provided there is no spoiling of the public money, and provided that such taxes conform with the Sharee'ah and are bearable by the people.
Now, it is unlawful to work there if the aforementioned conditions of permissibility are not met.
The second situation is when this tax collection is in a non-Muslim country. In this case, it is unlawful to work in it, unless it is a just compensation for what is provided to them by the state where they live. Also, the tax should be imposed on both Muslims and non-Muslims and not taking taxes from the Muslim might hinder him from getting some of the services and facilities he needs.
As for working in ordinance factories (weapon factories, etc.), it is lawful in Muslim countries, and can even be highly rewarded if the person had a proper intention before undertaking it, like intending to prepare the Muslims for Jihaad (fighting in the Cause of Allah) and adding to their strength against their enemies. The Prophet said: “Allaah, The Most High, will cause three persons to enter Paradise for one arrow: the maker when he has a good motive in making it, the one who shoots it, and the one who hands it; so shoot and ride, but your shooting is dearer to me than your riding. Everything with which a man amuses himself is vain except three (things): a man's training of his horse, his playing with his wife, and his shooting with his bow and arrow. If anyone abandons archery after becoming an adept through distaste for it, it is a blessing he has abandoned; or he said: for which he has been ungrateful.” [Ahmad and Al-Arna’oot graded it as Hassan]
But if such ordinances are in non-Muslim countries, it is unlawful to work in them as working there is a help and assistance for the non-Muslims against the Muslims. Allaah Says (what means): {……And they will never cease fighting you until they turn you back from your religion (Islamic Monotheism) if they can. …..} [Quran 2:217]
But it becomes lawful if the purpose is to learn new technologies and find out the different war strategies that the non-Muslims are preparing against the Muslims, and to transfer this technology to the Muslims, as the Muslim should do his best to weaken the non-Muslims who are enemies and disclose their conspiracies. But it is strictly forbidden to support them or fight in their ranks or help them in anyway, in fighting the Muslims. It is even forbidden to support non-Muslims or fight with them against other non-Muslims. The Prophet said: “And whoever fights under the flag of an ignorant fanatic group backing the fanatic, and ideas of that group or calling for them and dies on that state, his death then is like the death of a person in Jahiliyyah (Pre-Islamic Era of ignorance).” [Ahmed]
As for the diplomatic work, if it is for a Muslim country that applies the Sharee'ah rules and guarantees the rights of its citizens, then it is lawful. But if it is for a country that does not apply the Sharee'ah rules nor guarantees justice for its citizens, then it is unlawful. The evidence for this is the Hadeeth cited earlier (and do not be a monitor for them, a policeman, a tax collector or a treasurer). The rule is more emphatic when the country is a non-Muslim country. It is unlawful to work in its diplomatic mission or foreign affairs unless the purpose behind that is to know the conspiracies that these countries are preparing against the Muslims and trying to influence such bad decision and warn the Muslims against them. In this respect the Prophet Yusuf worked as a minister in a country of disbelief. By doing so, he succeeded in benefiting the Muslims, honoring them and meeting their needs and calling to Allah. As Allah Says (what means): {[Joseph] said, “Appoint me over the storehouses of the land. Indeed, I will be a knowing guardian.”} [Quran 12:55]
Allah also Says (what means): {And Joseph had already come to you before with clear proofs, but you remained in doubt of that which he brought to you, until when he died, you said, ‘Never will Allah send a messenger after him. Thus does Allah leave astray he who is a transgressor and skeptic.”} [Quran 40:34]
But, it is lawful for the Muslim living in non-Muslim countries to work in all fields provided the work he does is not contradictory to Islamic teachings. So, he should not work in any unlawful field or anything that humiliates the Muslims, like working as maid for a non-Muslim or working in collecting garbage or doing similar undignified jobs for non-Muslims. The Prophet said: "Islam is high and sublime and is not overtopped.” [Al-Bayhaqi, and Ibn Hajar and Al-Albaani classified it as Hassan]
In fact, working in such mean and lowly jobs to serve non-Muslims is contradictory to the high and honorable status of the believers mentioned in the following verse: Allah Says (what means): {And to Allah belongs [all] honor, and to His Messenger, and to the believers, but the hypocrites do not know.} [Quran 63:8]
The author of Mughni Al Muhtaj said after stating the lawfulness to work for a non-Muslim: “Lawful only if the work itself is not an ignoble one, like removing or collecting garbage. Otherwise, it should be undoubtedly avoided.”
As for the institution that combines between lawful and unlawful dealings, it is not lawful for the Muslim working in such institutions to carry out the forbidden dealings in those institutions or to help in achieving them. He should limit himself to that which is lawful only. Similarly it is unlawful for the Muslim to work in any job where unlawful dealings exceed lawful dealings.
Allaah Knows best.