Topological phases of lattice bosons with a dynamical gauge field