Detecting product splittings of CAT(0) spaces