Add at the end of each chapter file
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "THEMAINFILE"
to point AUCTeX to the main file. Furthermore, (quoting the AUCTeX manual)
if you often use
\input, you should make AUCTeX aware of the multi-file document structure. You can do this by inserting
(setq-default TeX-master nil) into your init file. Each time you open a new file, AUCTeX will then
ask you for a master file.
Or, if you usually use the same master filename
You should always set this variable to the name of the top level document. If you always use the same name for your top level documents, you can set TeX-master in your
(setq-default TeX-master "master") ; All master files called "master".