Cut your yarn a few inches (say 6 or so) beyond the last stitch. Then pull it through the last stitch and pull it tight.
After that, use a big needle to weave the end in as invisibly as possible. Or if the scarf is going to have a fringe, you can hide it in the fringe.
See Amy's video on cast off under Basic Techniques. Also, if you have the bandwidth, her video of a complete small project shows binding off through the last stitch.