Try the following steps in order until the error is resolved.
  1. Restart the SQL Server instance that the database is being attached to.
  2. Check the database files for the proper Windows Permissions.  (Both the Windows account logged in and the SYSTEM account, or whatever account is running the SQL Server Service) need to have Full NTFS permissions of the Folder and all the files where the database resides.
  3. Restore to a valid backup from before the database files were detached.