A colleague of mine submitted this hack for this problem a while ago but it looks like it has not been addressed so I am raising a bug. If you have two idl files with differing #pragma prefix definitions and nothing else in the files except an include from one of the files to the other you will receive a "ParseException: invalid scope for using a #pragma prefix, only usable outside of a module declarations.". This is of course a simplified example of the problem experienced.
On invstigation it appears to be due to the prefix not being reset at the end of each file. Adding the following line after the "m_fileStream.Close();" on line 266 of IDLPreprocessor.cs seems to get around the issue. There is most likely a more elegant solution than just injecting a canceling #pragma prefix definition though.
line to add:
m_outputStream.WriteLine("#pragma prefix \"\""); // reset the prefix at the end of each new file so the next file does not inherit the prefix
Hope this helps.