[verb (plain)] + ばかりに [i-adj] + ばかりに [na-adj] + な + ばかりに [noun] + である + ばかりに [verb ます-stem] + たい + ばかりに
ばかりに means "just because": that one thing, and only that, led to a bad result. It follows the plain form of a verb or an い-adjective, a な-adjective with な, or a noun with である, and the speaker looks back on it with regret or resentment.
The result has already happened and is unwelcome, often with てしまう. For a good result, use おかげで.
With たい, ばかりに gives a strong motive: someone wanted one thing so much that they went to great lengths for it. The result does not have to be bad.