This is all covered in the UFAQ.
Can the Corp use Mumbad City Hall when there is only one card in R&D? Does it matter if that card is an alliance card?
Yes you can, whether the last card is an alliance card or not. Since R&D is a hidden zone, the game doesn’t check whether the last card in R&D might meet the criteria for the search when determining if Mumbad City Hall’s ability has the potential to change the game state.
Can I use Mumbad City Hall to search for an alliance card that I can’t afford to play or install, just to shuffle R&D?
Mumbad City Hall can resolve at least partially any time there are cards in R&D, so it can be activated regardless of the outcome its effect will have. However, you can only fail to find on a search if there are no cards matching the search criteria. If there are any alliance cards in R&D that you can play or install, you must find one of them, reveal it, and play or install it. If there are only alliance cards that you cannot play or install, you must reveal one of them before shuffling it back into R&D. If there are no alliance cards in R&D, then you do not reveal any cards, and the effect just shuffles R&D.