Redshift inference from the combination of galaxy colours and clustering in a hierarchical Bayesian model