All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His Slave and Messenger.
Facing obstacles while attempting to accomplish something does not necessarily mean that Allaah The Exalted does not want the person to accomplish that objective. As long as the objective is beneficial, he is advised to strive in overcoming the obstacles and then place his trust in Allaah and entrust his affairs to Him. The Prophet, sallallaahu ‘alayhi wa sallam, advised us to utilize all the available means to accomplish our objectives and then place our trust in Allaah. Abu Hurayrah reported that the Prophet, sallallaahu ‘alayhi wa sallam, said: "Be keen on what benefits you and seek help from Allaah, and do not give up…." [Muslim]
It is very important to resort to Istikhaarah (guidance-seeking prayer) in this regard, for it implies delegating one's affairs to Allaah who is the Knower of the Unseen and He is the All-Knowing of what is to come. Please refer to Fatwa 226012 about Istikhaarah.
Such obstacles that a person faces may be a kind of trial and test (from Allaah). Even the Prophets and righteous people were afflicted with trials and tests. It has been reported that while digging the trench during the Battle of the Trench, "the Companions came upon a hard rock which they could not break with their axes. They told the Prophet, sallallaahu ‘alayhi wa sallam, so he took the axe and struck it several times until it was broken." [Ahmad and An-Nasaa’i - Al-Albaani graded it Hasan (good)]
Thus, the Companions did not give up and stop digging; rather, they sought the means to overcome that obstacle.
Allaah Knows best.