For baking, replace transparent BSDF with holdout for baking. This ensure no objects behind are baked, and that the baked image has alpha.