For more proof, here is the example under the rules for the Factory tile on page 10 of the English rules:
Example: David owns an occupied factory, 3 occupied corn plantations, 3 occupied
sugar plantations, 1 occupied tobacco plantation, and the associated production
buildings with the necessary number of colonists. He produces only 2 sugar barrels
and 1 tobacco barrel as there is no corn and only 2 sugar barrels in the supply. He
earns 1 doubloon from the bank for producing 2 kinds of goods.
So yes, when a particular resource runs out, it no longer qualifies for the Factory.