We study the electronic structure and correlations of vitamin B12 (cyanocobalamine) by using the framework of the multi-orbital single-impurity Haldane-Anderson model of a transition-metal impurity in a semiconductor host. The parameters of the effective Haldane-Anderson model are obtained within the Hartree-Fock (HF) approximation. The quantum Monte Carlo (QMC) technique is then used to calculate the one-electron and magnetic correlation functions of this effective model. We observe that new states form inside the semiconductor gap found by HF due to the intra-orbital Coulomb interaction at the impurity 3d orbitals. In particular, the lowest unoccupied states correspond to an impurity bound state, which consists of states from mainly the CN axial ligand and the corring ring as well as the Co e_g-like orbitals. We also observe that the Co(3d) orbitals can develop antiferromagnetic correlations with the surrounding atoms depending on the filling of the impurity bound states. In addition, we make comparisons of the HF+QMC data with the density functional theory calculations. We also discuss the photoabsorption spectrum of cyanocobalamine.