Just a point of clarification on Bava Metziya 106 - the gemara writes that a landlord can claim Hashem would have listened to his tefillah to spare his specific crops (making the renter who planted a different crop liable for the loss even in a case of a natural disaster), but if he does not include terms for specific crops to be planted, then he cannot claim Hashem would spare his crops because of his general non-specific tefillah for success. R' Tzadok haKohein (Divrei Sofrim #4) explains that this rule has to be taken in the context of the gemara's case of the farmer asking Hashem to make an exception of his crops in the midst of a natural disaster affecting all. When asking for miraculous exceptions, one should minimize the miracle as much as possible, as Hashem does not often or readily change the course of nature. There is a great difference between asking Hashem to completely distort reality and grant your crops success when all others fail and asking for a specific exception of one crop amidst the devistation shared with everyone else. To put it in business terms that we can relate to: there is a difference between davening for the entire stock market to reverse its trend amidst a downturn and daving for a specific stock to buck the trend while the downturn plays out. Outside that context, when there is no trend, no disaster, no exception is being asked for, R' Tzadok writes that one can and should daven in general for bracha and hatzlacha.
I do not think Bnei Yisrael's general tefillos to be spared from the attacking enemy contradict the rule of this gemara. Firstly, they had no other choice, as the enemy was not clearly identifiable. Secondly, the gemara is concerned with the liability of the person to pay the landlord based on the assumption that the landlord's tefilos work - the gemara concludes that in the case of general tefilla there is not enough of a guarantee of a response to create liability, but that does not mean Hashem never responds to a general tefillah. Thirdly, there is a difference between the word 'kol' and 'dibbur', as we discussed here. Kol is the tone, manner, and passion of the cry; dibbur is the articulation of the words. I would like to suggest that Hashem did not in fact respond to the words of the tefillah here, but ‘VaYishma Hashem b’kol yisrael’, the response was to the unarticulated passion of the plea. Even though the tefillah was stam, the voice was strong enough to arouse Hashem to respond.