If you want to build a ship that costs more resources than your Warehouses can hold, there are two ways to go about it. The first is to overfill your Warehouses. This is how to do that:
The second way is to build the ship in two stages. Start by building a ship in your Shipyard with only one component on it.
Once this build is complete, you can refit the ship with whatever weapons, armors, and specials you want. Performing a two-stage build means you will never need more than your Warehouses can hold at one time.