Detach SQL Server database without deleting it?
Detaching a DB will remove it's entry from the internal list of DBs managed by Master but will leave the file there to re-attach.  This often could be perhaps not the best course of action to take but to do it follow the MS docs for detach a database.

You could execute the following but it could fail if users are connected to the database in your instance:

EXEC sp_detach_db 'Databasename', 'true';  


You could always run a quick sp_who2 to see who is connected to your database or a more thorough:

select spid, status, loginame, hostname, blocked, db_name(dbid), cmd from master..sysprocesses where db_name(dbid) = 'databasename'


As BradC has answered, taking a database 'offline' is also a good option which has it's own benefit and drawback.  Detaching unlocks the file so you could have the file manipulated while it it detached.  Just note having a database 'offline' can cause your scripts or maintenance tasks that scan all your databases to report failures.  It will still 'see' the database, try to access it, but it will not be able to.  Typically most maintenance scripts I write have logic to handle this but many in the wild do not so just note that.