Singularity theorems for warped products and the stability of spatial extra dimensions