These flags supersede the standard UNIX permissions. If a file is locked, that overrides the write permissions so that applications treat the file as read-only. If a folder is locked, no files can be added or removed from that folder, no matter what the write permissions on the folder are. These restrictions apply to all users, independent of the permissions that are set on the files or folders. They even apply to the root user (or to admin users using sudo).
You can view the state of the "locked" flag for a file or folder by using File -> Get Info in Finder. The Get Info window allows you to change the locked state of a file (i.e. you can unlock a file that is locked, or lock a file that is unlocked) if you are the owner of that file. But there is no way to change the locked state of a folder using the Get Info window -- the checkbox is always dimmed.
However, it is possible to change this flag by using the command line (in Terminal). Suppose that the folder is named MyStuff. Then the following command would make it locked:
% chflags uchg MyStuffYou could subsequently unlock that folder by doing:
% chflags nouchg MyStuffThe only documentation that I could find about these extra flags is the UNIX man page for the command chflags (execute the command man chflags to read it). It lists the following flags:
arch "archived flag" opaque "opaque flag" nodump "nodump flag" sappnd "system append-only flag" schg "system immutable flag" uappnd "user append-only flag" uchg "user immutable flag"The uchg flag is the one used for locking files and folders (as illustrated above). If the uchg flag is set, the file or folder is locked. You prefix the flag name with no when using the chflags command if you want to unset the flag (as illustrated above). The uchg flag can only be set or unset by the file's owner or by an admin user using sudo.
The schg flag can also be used to lock a file or folder. However, this flag can only be set by the root user or an admin user using sudo. And once set, it is much harder to unset it, so it is more permanent. The schg flag can only be unset in single-user mode (restart your Mac and hold down Command-S after the chime).
You can see the state of these extra flags with the ls command in Terminal if you use the -lo option; i.e. ls -lod MyStuff shows the flags for the MyStuff folder.
I don't know anything more about the arch flag. The opaque flags is only relevant if you use the "union" option when mounting a filesystem (and I don't know if OS X currently supports that option). The nodump flag is only relevant when using the dump command. But the uappnd and sappnd flags are potentially quite useful. If the uappnd flag is set on a file, the file cannot be changed except by appending data to the end of the file (e.g. with cat >> myfile).
If the uappnd flag is set on a folder, new files may be added to that folder, but the files in that folder cannot be renamed and no files may be removed from the folder. The uappnd flag can only be set or unset by the file's owner or by an admin user using sudo.
The sappnd flag gives the same effects but (like schg) is more permanent, being only unsettable in single-user mode. There is no indication of the state of these "append" flags in Finder's Get Info window.
Especially since the state of most of these flags is not visible in Finder, it would be a good idea to keep a separate document recording which files or folders you changed the flags on. That way you have something to remind you what you changed if troubles occur sometime later. Note also that Apple does not document the behaviour of most of these flags, so you would be well advised to do thorough tests before relying on them in a production environment.
There have been a few previous hints (1, 2) that mentioned the uchg & schg flags in connection with troubles when trying to delete files, but I haven't seen anything that explained about the use of uchg to lock folders nor anything about the use of uappnd.
Note also that there are several 3rd-party utilities that provide GUIs for setting some of these flags. I haven't tried these utilities myself, so I won't mention them here.

