How to prevent actions using Flag (or similar) module?
I haven't done this, but if you want a library check in/check out system this is the approach I would try.  Create a flag (here I'll call it Check out) that allows users to "check out" files.  Make sure this is a global flag.  Name the unflag link "Check in" or something similar.  (You could also automatically have files checked back in after a certain interval with Rules Scheduler.)

Then, I would create views so that users cannot see the nodes that are checked out.  To actually enforce security, I would also add a rule that automatically redirects users away from the page of any node that they did not flag that has been flagged (this probably will cause a performance hit and may not be the most secure way but will probably work for general cases).