Though common in informal communication, alot has never made its way into edited writing, and it’s generally considered a misspelling. In any type of serious writing, the two word spelling, a lot, is the safer choice. Even correctly spelled, however, the imprecise term has a colloquial ring, and it might sound out of place in, say, a school paper or an email to a client.
A lot is like any two-word phrase with the indefinite article (a) followed by a noun (lot). For instance, a cow, a cloud, and a burrito are similarly constructed phrases, but no one would write these acow, acloud, and aburrito. Why a lot is so often compounded into alot is an interesting linguistic mystery. It may have something to do with the existence of the unrelated adjective allot, or it could be because lot in this sense is not common outside this phrase (though the plural, lots, is also common in a nearly identical use).
The ngram below graphs the use of a lot and alot in a large number of texts published between 1900 and 2000. As you can see, alot (the red line) does not even register against a lot, suggesting that the one-word form does not pass through the editorial process.