To get out of that you have to choose one of the unfinished building and keep just enough material for that one. Sell ALL the excess and keep selling until you get enough of that elusive 3rd material. Once done, choose a second building and do the same. Meanwhile do not build community buildings. After you have completed all the unfinished ones, just build one at a time.