Construction of the steady state density matrix and quasilocal charges for the spin-1/2 XXZ chain with boundary magnetic fields