Compatibility level when upgrading a SQL Server 2005 database to SQL Server 2012
You can not set the compatibility level of a SQL Server 2005 instance to anything higher.
Hence the upgrade path:

Create SQL Server 2012 Server / Instance.


Option 1: Backup / Restore; change compatibility level.
Option 2: Detach, copy, Attach; change compatibility level.


Option 1 is most used because you have overlap (old is available, new can be tested).
Rollback to previous is certain.

Misread your question. You want to remain at SQL 2005 compatibility: Don't change compatibility level during option 1 or 2. Compatibility is configured at the database level.