  Doping is considered to be the main method for improving the thermoelectric
performance of layered sodium cobaltate (Na$_{1-x}$CoO$_2$). However, in the
vast majority of past reports, the equilibrium location of the dopant in the
Na$_{1-x}$CoO$_2$'s complex layered lattice has not been confidently
identified. Consequently, a universal strategy for choosing a suitable dopant
for enhancing Na$_{1-x}$CoO$_2$'s figure of merit is yet to be established.
Here, by examining the formation energy of Gd and Yb dopants in
Na$_{0.75}$CoO$_2$ and Na$_{0.50}$CoO$_2$, we demonstrate that in an oxygen
poor environment, Gd and Yb dopants reside in the Na layer while in an oxygen
rich environment these dopants replace a Co in CoO$_2$ layer. When at Na layer,
Gd and Yb dopants reduce the carrier concentration via electron-hole
recombination, simultaneously increasing the Seebeck coefficient ($S$) and
reducing electric conductivity ($\sigma$). Na site doping, however, improves
the thermoelectric power factor (PF) only in Na$_{0.50}$CoO$_2$. When replacing
a Co, these dopants reduce $S$ and PF. The results demonstrate how
thermoelectric performance critically depends on the synthesis environment that
must be fine-tuned for achieving any thermoelectric enhancement.
