The Classic Bedroom Loft
Where you have sufficient space and height, you can construct a "raised room," 7 feet or more above the ground-level living space. Lofts of this kind need to be sturdily constructed using 2 x 6 or 2 x 8 joists on 16" or 24" centers, 4 x 6 posts, braced, at least 1/2" plywood flooring and either a 36" to 42" railing or fully enclosed walls. Access it with a ladder.
The "Low Bed Loft" for Smaller Apartments
You can't fit a classic bed loft into a space with an 8" or 9" ceiling. You can still build a "low bed loft" 5 feet above ground level, freeing up space beneath it for storage. Alternatively, one side of the low bed loft becomes storage space; the other side creates a nook deep enough for a work desk. You can buy the storage units first, then build the low bed loft on top of them. Access with a ladder or with steps (which also provide under-stairs storage).
The High Platform Bed
You can built a platform about 3 feet high without railings; the space under the platform still provides a lot of storage; you no longer need a ladder or stairs. Alternatively, you can even build (or have built for you) a custom storage cabinet that supports the mattress; you no longer need a separate platform.