Scanning-probe study of dopant charging in a semiconductor heterostructure